Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jone0497
Starting Member
8 Posts |
Posted - 2007-02-16 : 11:29:39
|
Hello,I was wonder what the arguments were for using one over the other:DECLARE @JobID BINARY(16) vsDECLARE @JobID UNIQUEIDENTIFIERBoth get used the same:EXECUTE @ReturnCode = msdb.dbo.sp_add_job @job_id = @JobID OUTPUT, ...I have seen these both on sample TSQL code, along with it not even being declared and just being used as shown here.Thanks,JJ |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-16 : 11:36:03
|
Bort are 128 bit binary values, just formatted two different ways.Peter LarssonHelsingborg, Sweden |
|
|
jone0497
Starting Member
8 Posts |
Posted - 2007-02-16 : 11:41:11
|
Are there any performance benefits to either format over the other? |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-02-16 : 15:02:59
|
Performance should be exactly the same, its more in the intent of the two. Binary is generic, it can hold pretty much anything, uniqueidentifier can only hold GUIDs. Try this for exampledeclare @one binary(16)declare @two uniqueidentifierselect @one = newid(), @two = newid()select @one, @twoselect @one = cast(getdate() as binary(16))--, @two = cast(getdate() as uniqueidentifier)select @one, @two |
|
|
|
|
|
|
|