I am writing an insert stamenet that appears like:
INSERT INTO SppTarget (IndicatorNumber, Part, Years, Target, CompareMethod)
SELECT '8', 'B', '20052006', '0.682', '1' UNION ALL
SELECT '8', 'B', '20062007', '0.688', '1' UNION ALL
SELECT '8', 'B', '20072008', '0.692', '1'
What if I want to SET Target = NULL in this statement, how can i do that?
Hey. I need to substitute a value from a table if the input var is null. This is fine if the value coming from table is not null. But, it the table value is also null, it doesn't work. The problem I'm getting is in the isnull line which is in Dark green color because @inFileVersion is set to null explicitly and when the isnull function evaluates, value returned from DR.FileVersion is also null which is correct. I want the null=null to return true which is why i set ansi_nulls off. But it doesn't return anything. And the select statement should return something but in my case it returns null. If I comment the isnull statements in the where clause, everything works fine. Please tell me what am I doing wrong. Is it possible to do this without setting the ansi_nulls to off??? Thank you
set ansi_nulls off
go
declare
@inFileName VARCHAR (100),
@inFileSize INT,
@Id int,
@inlanguageid INT,
@inFileVersion VARCHAR (100),
@ExeState int
set @inFileName = 'A0006337.EXE'
set @inFileSize = 28796
set @Id= 1
set @inlanguageid =null
set @inFileVersion =NULL
set @ExeState =0
select Dr.StateID from table1 dR
where
DR.[FileName] = @inFileName
AND DR.FileSize =@inFileSize
AND DR.FileVersion = isnull(@inFileVersion,DR.FileVersion)
I have set up a MSX server for managing all of our backup jobs. However when I try and create a DB maintenence plan I can only see the system DBs not user created ones!
I have several target servers defined, i have a job that needs to run in a serial fashion (ie.. 1 target at at time) if every target kicks off the job at the same time it's going to bog down the disk drives... can this be serialized? or do i need to write a special routine...
Does anyone know how to add a hyperlink with a target frame. In the navigation tab of reporting services I am having difficulites adding http://www.linkgoeshere.com target="framename"
In this situation do I need a proxy or forwarder at both ends to prevent connection issues? Are there plans to handle this in future SSSB upgrades. Thanks.
I've created an SSIS package to be loaded using my ASP .NET app. This package is kept within the application and loaded via Microsoft.SqlServer.Dts.Runtime.LoadPackage method.
My target machine does not have MS SQL Server 2005 installed. So what do I need at minimum to get this up and running? What components do I've to install or copy over?
I tried to copy just the class libraries across. I copied Microsoft.SQLServer.ManagedDTS.dll and Microsoft.SQLServer.DTSRuntimeWrap.dll into my bin directory but I got this error:
[COMException (0x80040154): Retrieving the COM class factory for component with CLSID {E44847F1-FD8C-4251-B5DA-B04BB22E236E} failed due to the following error: 80040154.] Microsoft.SqlServer.Dts.Runtime.Application..ctor() +25
[DtsPipelineException: Retrieving the COM class factory for component with CLSID {E44847F1-FD8C-4251-B5DA-B04BB22E236E} failed due to the following error: 80040154.] Microsoft.SqlServer.Dts.Runtime.Application..ctor() +87
I can't find any information online so any insight or advice will be very much appreciated!
Can someone please help me with the following error?
I am trying to create a trigger that copies data from a table in one database to another. However I am getting the error 'Cannot create trigger on databasename.dbo.tablename as the target is not in the current database.
Below is the SQL I am using to create the trigger:
Hi, I am sending a message to an invalid target name. The message eventually gets back to the initiator as an error type message. How can I determine the exact cause of the error - and determine that the target service name is invalid? I am using the ServiceBrokerInterface and the Message does not tell much - it seems. Also, in the sys.conversation_endpoints table, the record associated to the message only says 'Error', but no other indicator.
I receive messages in my target queue but target queue continously become disabled even aften I enable and receive message it still says target queue is disabled?
In Opening a display of invoices in Report Server I have a ULR link in the Jump to URL section under the navigation tab.
I have the URL with the invoice number in the expression. Is there something I can add to this expression that will force the interface to Open a new windows page instead of the existing window?
I'm thinking aboug using Service Broker to aggregate transactions from 12 remote SQL Servers to a central SQL Server. Service Broker is new to me, so I don't know what the proper setup would be.
We have five different kinds of transactions that can be sent from any of the remote servers. These remote servers truly are remote, connecting to the central server over a WAN. We don't want problems with one server to interfere with any other server. We also don't want problems with one kind of transaction to interfere with the processing of any other kind of transaction.
If were only talking about one remote server, I'm guessing I'd want to create 5 different services - one for each kind of transaction. Does that mean I'd also need to create 5 different routes on both the remote server and the central server?
And how would I scale this out to a dozen remote servers? Can I stick with 5 services on the central server, or would I need to define 5 different services for each remote server, so 60 total? And would that be 60 different routes defined on the central server? Based on my limited knowledge of routes and how they're tied to services, I think that would mean 60 routes, but maybe I'm missing something.
I am creating a queue application using Service broker. I was able to send and receieve messages between 2 databases in the same instance. Now I am trying to communicate b/w 2 different instances. I am getting the following error...
The target service name could not be found. Ensure that the service name is specified correctly and/or the routing information has been supplied..
We've got a source file which owns three different values: 'A','B','M'.
Where 'A' stands for "New Rows" and 'B' for "Delete rows" and 'M' for 'Update rows'
Using Conditional Split task we can redirect each subset into a OLEDB Destination but we are wondering how can we do the same using only one OLEDB? We've got only one table.
In my report i have CNAME parameter , which allows null value. I checked Allow null value check box in report parameter properties.
when i preview the report , it displays checked NULL check box beside CNAME parameter . I want to give some meaningful name(i.e.ALLCustomers) to this checkbox instead of NULL.
In the flat file SampleID and Product are populated in the first row only, rest of the rows only have values for Rep_Number, Protein, Fat, Solids.
SampleID and Product are blank for the rest of the rows. So my task is to fill those blank rows with the first row that has the sampleID and Product and load into the table.
I've installed SQL Server 2000 and applied SP3a. I see SP4 is available and fixes a lot of things. The only bit I am unsure about is section '5.3.2 Changes to Master/Target Server Configurations' http://download.microsoft.com/download/1/b/d/1bdf5b78-584e-4de0-b36f-c44e06b0d2a3/ReadmeSql2k32sp4.htm#_5464_sql_server_agent_enhancements_705 "Before you apply SP4, you must complete several steps to upgrade your SQL Server 2000 master/target server configuration. The changes that are introduced with SP4 are not compatible with SQL Server 7.0 target servers, or with any servers not running SP3 or later. This is a change from the original SQL Server 2000 functionality. " As I'm just starting out I don't even know what 'Master/Target Server' is. I'm only installing to my PC which is XP Pro SP2. Can I ignore this step and apply the patch or do I need to do as it states? Thanks
I need to create an Bulk upload utility using ASP.Net and SQL Server. Below is the process for the uploads -
Excel Template wherein user will enter the details. A Tab-delimited output file will be generated using the VBA. There are 2 tables - one is Temp Table which is replica of the the final table and second is the final table Using File.OpenText(filePath).ReadLine() - All the Rows from the tab delimited data file will be inserted into DataTable.
using SQLBulkCopy the tab-delimited data file data will be inserted into the Temp Table.
Data will be validated based on the data inserted in the temp table. If the data as errors then the temp table will be cleared else the data will be inserted from the temp table to the final table.
My Issue is that in both the tables there is a column (Name : PeopleKey (Int PrimaryKey)). If the user enters Alphabetic value then the Bulk Utility is failing. Below are the two options in my mind -
1. I can change the DataType in Temp table from int to VARCHAR. So, the data can be inserted at first and then I can validate and get the data corrected. But i am not sure whether it is the right way to fix issue as the source and target tables columns are different.
2. When the data in inserted into the Datatable by following Step 3. So, once the data in inserted into DataTable then i can validate there. Thus the source and target tables Datatype will be same.
I need to copy data from 3 tables in one database into another db. The destination db already contains some data and it is expected that there will be duplicates which we do not want to have copied across (I think there is a constraint that prevents duplicate email addresses which is our main search field)
The three tables are effectively a user table, an address table, and a [phone] numbers table, each of which has an auto generated id field. The user table also maintains a reference to the address and numbers tables.
We are using SQL Server 8 (SP3) and it has been suggested that I use the data transformation service (DTS) tool which I have used numerous times to copy entire databases, but I can't figure this bit out.
I am still learning t-sql using SQL Query Analyzer, but have been doing so for a while and think that I'm fairly competent in it. My main question is this: Is it possible to connect to two DBs at the same time in SQL QA? If so, I'm pretty sure that I could work out how to pass the data across, I'd just need to know how to connect to them both.
Any help would be much appreciated. If you need any more information to help, please let me know.
I want to replicate a database to a subscriber that will be used as a readonly copy. The data has to be replicated as close to instantly as possible.To do this I set up a database export of objects and data to populate thesubscriber, then I set up transactional replication. To verify thatreplication is working successfully, I count the rows in each table, thereare 3 tables in total. For one of the tables, the replication completes butalmost immediately afterward, the table starts to shrink, and after severalhours the record count is zero. This isn't happening to the other twotables, and I can't figure out why.If you have no idea what might be causing this, perhaps you can suggestsome places to start looking. This is Win2k SP4 with SQL 2000 SP3.Thanks much.
We have problems with duplicate messages in Service Broker queues. We have tried the "fire and forget" method.
Senario Initiator doing SEND and END Conversation , target doing RECEIVE and End Conversation , Sql servar agent job runing every minute doing End conversation with cleanup in sys.conversations_endpionts queue.
We are runing 5000 - 10000 messages per minute.
When the clean up job is running we get som duplicte messages in the target queue.
Enviroment Two separate machines runing Sql Server 2005 Standard Editon SP2
Initiator Machine
CREATE MESSAGE TYPE [TransactionStatisticsSend] AUTHORIZATION [dbo] VALIDATION = WELL_FORMED_XML
CREATE CONTRACT [TransactionStatistics] AUTHORIZATION [dbo] ([TransactionStatisticsSend] SENT BY ANY)
CREATE QUEUE [dbo].[TransactionStatisticsQueueActive] WITH STATUS = ON , RETENTION = OFF ON [PRIMARY]
CREATE SERVICE [TransactionStatisticsServiceActive] AUTHORIZATION [dbo] ON QUEUE [dbo].[TransactionStatisticsQueueActive] ([TransactionStatistics])
CREATE REMOTE SERVICE BINDING [RSB::TransactionStatisticsServiceStat] AUTHORIZATION [dbo] TO SERVICE N'TransactionStatisticsServiceStat' WITH USER = [Proxy::BtsDebitServiceStat] , ANONYMOUS = OFF
ALTER PROCEDURE [dbo].[Bts_SP_TransactionStatPrepare] (@TransferID varchar(30)) AS declare @RowCount Int, @ErrorSave Int, @Msg xml, @dialog_handle UNIQUEIDENTIFIER
Begin
BEGIN TRY
set @msg = (Select Regtime, SendPartShortName, RecPartShortName, MsgType, From btslogactive.dbo.StatTransferlog Tl where TransferID = @TransferID FOR XML RAW)
BEGIN DIALOG CONVERSATION @dialog_handle FROM SERVICE [TransactionStatisticsServiceActive] TO SERVICE 'TransactionStatisticsServiceStat' ON CONTRACT [TransactionStatistics] WITH ENCRYPTION = OFF ;
SEND ON CONVERSATION @dialog_handle MESSAGE TYPE [TransactionStatisticsSend] (@msg) ; END CONVERSATION @dialog_handle
END TRY BEGIN CATCH SELECT ERROR_NUMBER() as ErrorNumber, ERROR_MESSAGE() as ErrorMessage; END CATCH
End
Target Machine
CREATE MESSAGE TYPE [TransactionStatisticsSend] AUTHORIZATION [dbo] VALIDATION = WELL_FORMED_XML
CREATE CONTRACT [TransactionStatistics] AUTHORIZATION [dbo] ([TransactionStatisticsSend] SENT BY ANY)
CREATE QUEUE [dbo].[TransactionStatisticsQueueStat] WITH STATUS = ON , RETENTION = OFF , ACTIVATION ( STATUS = ON , PROCEDURE_NAME = [dbo].[Bts_SP_TransactionStatUpdateBroker] , MAX_QUEUE_READERS = 1 , EXECUTE AS N'dbo' ) ON [PRIMARY]
CREATE SERVICE [TransactionStatisticsServiceStat] AUTHORIZATION [dbo] ON QUEUE [dbo].[TransactionStatisticsQueueStat] ([TransactionStatistics])
ALTER PROCEDURE [dbo].[Bts_SP_TransactionStatUpdateBroker]
AS
DECLARE @MessageType sysname DECLARE @ConversationHandle uniqueidentifier DECLARE @MessageBody XML DECLARE @RegTime datetime, @SendPartShortName varchar(30), @RecPartShortName varchar(30), @RC int
BEGIN TRANSACTION; WHILE (1=1) BEGIN WAITFOR ( RECEIVE TOP (1) @MessageType = message_type_name, @MessageBody = message_body, @ConversationHandle = conversation_handle, @SeqNo = message_sequence_number FROM [TransactionStatisticsQueueStat] ), TIMEOUT 5000;
IF (@@ROWCOUNT = 0) BEGIN ROLLBACK TRANSACTION RETURN END
IF (@MessageType = 'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog') BEGIN END CONVERSATION @ConversationHandle BREAK END ELSE IF (@MessageType = 'http://schemas.microsoft.com/SQL/ServiceBroker/Error') BEGIN END CONVERSATION @ConversationHandle BREAK END ELSE IF (@MessageType = 'TransactionStatisticsSend') BEGIN Begin try SET @RegTime = @MessageBody.value('(/row/@Regtime)[1]', 'datetime') SET @SendPartShortName = @MessageBody.value('(/row/@SendPartShortName)[1]', 'varchar(30)') SET @RecPartShortName = @MessageBody.value('(/row/@RecPartShortName)[1]', 'varchar(30)') SET @MsgType = @MessageBody.value('(/row/@MsgType)[1]', 'varchar(30)')
.
End try BEGIN CATCH SELECT ERROR_NUMBER() as ErrorNumber, ERROR_MESSAGE() as ErrorMessage; END CONVERSATION @ConversationHandle BREAK END CATCH
-- EXEC @RC = SP_XXXXX
END END CONVERSATION @ConversationHandle BREAK END END COMMIT TRANSACTION RETURN
Sql Server Agent job procedure
ALTER PROCEDURE [dbo].[Bts_SP_Del_Conversation_Endpoints]
AS begin DECLARE c_PurgeConversationEndpoints CURSOR FAST_FORWARD FOR SELECT conversation_handle FROM sys.conversation_endpoints with (nolock) WHERE is_system = 0 AND [State] = 'CD';
OPEN c_PurgeConversationEndpoints; DECLARE @DialogHandle UNIQUEIDENTIFIER; FETCH NEXT FROM c_PurgeConversationEndpoints INTO @DialogHandle; WHILE @@FETCH_STATUS = 0 BEGIN END CONVERSATION @DialogHandle WITH CLEANUP; FETCH NEXT FROM c_PurgeConversationEndpoints INTO @DialogHandle; END CLOSE c_PurgeConversationEndpoints; DEALLOCATE c_PurgeConversationEndpoints;
I have a problem using service broker, a send the message from server SSB1(initiator) and a receive this message on server SSB2(target), but I don't receive response to SSB1...
In my server SSB2 has this messages on Profiler: - This message could not be delivered because it is a duplicate. - Could not forward the message because forwarding is disabled in this SQL Server instance. - The message could not be delivered because it could not be classified. Enable broker message classification trace to see the reason for the failure.
Message from SSB1 Profiler:
- This message was dropped because it could not be dispatched on time. State: 1
Getting this error "Exception Has been thrown by the target of an invocation" when trying to create Integration Services Project. Any ideas what can be wrong?
I am ending conversations properly for a dialog, the end conversation at the target properly marks the conversation as closed in sys.conversation_endpoints and sends the EndDialog message to the initiator.
The initiator get the EndDialog message from the target and ends the conversation and it clears out of sys.conversation_endpoints.
I know that to avoid reply attacks that the conversation at the target will only clear out in 30 minutes.
However it has been a day now and the conversation is still sitting in sys.conversation_endpoints as CLOSED at the target.
How do i troubleshoot this ? Why is the conversation not clearing?
We host our reports in an ASP.NET page using a rsweb:reportviewer control. This is contained within a frameset in the web site. I've created a "Jump to URL" on a report field from this report to another page hosted on the same site. This works, but the problem is that the report gets rendered with a hyperlink that has a TARGET="_top" attribute in it. Is there any way to override this. This pops out of the frameset because of this.
We are using service broker between two different instances. But were facing issues with increasing row count in conversation_endpoints view. We found that this was because we were using default value for lifetime for the conversation which is value of size int. Later on we changed the lifetime to 1 minute and conversation_endpoints view start getting cleaned up after 30 minutes
Following commands are used to send message
Before :
BEGIN DIALOG CONVERSATION @handle FROM SERVICE @SendService TO SERVICE @ReceiveService ON CONTRACT @Contract SEND ON CONVERSATION @handle MESSAGE TYPE @xmlMessageType(@xmlMessage);
END CONVERSATION @handle;
After:
BEGIN DIALOG CONVERSATION @handle FROM SERVICE @SendService TO SERVICE @ReceiveService ON CONTRACT @Contract WITH LIFETIME = @lifetime;
SEND ON CONVERSATION @handle MESSAGE TYPE @xmlMessageType(@xmlMessage);
END CONVERSATION @handle;
But as we use default life time for a long due to which around 15 million records got acumlated in this view. What is the best way to clean up this view.
END Conversation @handle with cleanup is taking so long is their any other way to do this
We need to pull from a table that is named tablename_mmddyy and populate a table with the same format tablename_mmddyy. The date will be different every month so I want to be able to build the tablenames every month. Is there a way to do this in SSIS? Thank you.