troubleshooting Question

GUID copied from one table to another

Avatar of LuckyLucks
LuckyLucks asked on
Microsoft SQL ServerMicrosoft SQL Server 2008SQL
4 Comments1 Solution822 ViewsLast Modified:
Hello EEE
I have a GUID value that is retreived from a table1 that I am trying to insert into table2. Both the source and destination tables have the datatype uniqueidentifier. However, on an insert to table2,  this column is being set to null. Can we copy guid columns from one table to another? Or is the issue something else.

declare @myGUIDsrc uniqueidentifier

select  @myGUIDsrc = column1  from table1  <---- only one row and GUID value is returned

insert into table2 (column1, column2) values (@myGUIDsrc , 'TEST')
Tomas Helgi Johannsson
Database Administrator / Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros