Difference between revisions of "GUID fromString N"
From RayHarwood
Rayharwood (Talk | contribs) (Created page with "There are several formats acceptable for GUIDs, but SQL only accepts "D-Format" GUIDs when inserting into the database. If you have a 32 character hex string (an "N-Format" G...") |
Rayharwood (Talk | contribs) |
||
| Line 37: | Line 37: | ||
Then, when doing an insert, use the function in a manner similar to this: | Then, when doing an insert, use the function in a manner similar to this: | ||
| + | |||
| + | INSERT INTO [MyDatabase].[dbo].[DestinationTable] | ||
| + | ([GoodGUID] | ||
| + | ,[OtherInfo]) | ||
| + | select | ||
| + | [MyDatabase].dbo.GUID_fromString_N(S.[StringKeyField]) | ||
| + | ,'Oh yeah, we did it!' | ||
| + | FROM [MyDatabase].[dbo].[SourceTable] S | ||