August 10, 2015 at 9:18 am
Hello All,
I'm trying to load data from old SQL server 2000 to new SQL server 2014. I need to do a checksum to check if all the source data is loaded in the target database(SQL server 2014). I've created the insert statement for the same which works. I need to use checksum to make sure all the source rows are loaded in the target table. Can somebody help me with this process? I haven't done checksum before.
Any help is appreciated.
Here is my insert statement:
INSERT INTO [Test].[dbo].[Order_tab]
([rec_id]
,[date_loaded]
,[Name1]
,[Name2]
,[Address1]
,[Address2]
,[City]
,[State]
,[Zipcode]
,[e_Name1])
SELECT s.[rec_id]
,s.[date_loaded]
,s.[Name1]
,s.[Name2]
,s.[Address1]
,s.[Address2]
,s.[City]
,s.[State]
,s.[Zipcode]
,ENCRYPTBYKEY(key_guid('EncryptionKey'),s.[Name1])
FROM [LinkedServer].[SourceTest].[dbo].[Order_tab] s
left join [Test].[dbo].[Order_tab] d on d.rec_id= s.rec_id
where d.rec_id IS NULL
August 10, 2015 at 9:44 am
Any help is appreciated. Thanks.
August 10, 2015 at 11:01 am
SSRS Newbie (8/10/2015)
Any help is appreciated. Thanks.
Can't help but wonder why you want to use CHECKSUM... perhaps the combination of Linked Server and ENCRYPTION is going to cause this INSERT to take a while? Are there any other constraints? Also, I noticed that you are inserting a Name field as well as inserting it Encrypted. Not sure why you would do that unless you are planning on some form of column security on the unencrypted one. In any case, CHECKSUM_AGG() appears to be what you need, or possibly just CHECKSUM(), but the latter only operates at the row level. What do you hope CHECKSUM will do for you?
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply