GUID in MS SQL

This is a discussion on "GUID in MS SQL" within the Databases section. This forum, and the thread "GUID in MS SQL are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 23rd, 2005, 13:23
New Member
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
GUID in MS SQL

Could anyone tell me what the easiest way is to have an automatically generated GUID field in SQL Server? For my purposes the field must be of Text type and just have a default value of a new GUID.

Thanks in advance,
Tim
Web Design
Reply With Quote

  #2 (permalink)  
Old Nov 24th, 2005, 12:25
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Re: GUID in MS SQL

Code: Select all
DECLARE @GUID uniqueidentifier
SET @GUID = NEWID()
INSERT Item VALUES (@GUID,'text text text')
Reply With Quote
Reply

Tags
guid, sql

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:57.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43