Solved

uniqueidentifier data type in MS SQL 2005

Posted on 2008-06-22
1
2,599 Views
Last Modified: 2010-05-18
I'm using MS SQL Server 2005 Management Studio Express to create a simple database that will manage customer-specific PDF documents that customers will have access to on the company website. The files will be stored on the server's file system and this database will just manage the links to those documents. I'm building this with MS Visual Studio Web Developer 2008 Express Edition. I'm just building a sample site on my local drive; not production at this point.

If I use the uniqueidentifier data type in a table, how is that unique identifier number generated? Do I have to manually generate it in code when I add an item to that table or is this a GUID that the system generates automatically? Thanks.
0
Comment
Question by:WineGeek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 21841980
>Do I have to manually generate it in code
yes/no.

let me explain:
no -> you could use the newid() function as default.

however, if you want to retrieve/know the generated value, it will be better if you generate it in your (sql) code for the insert, and return it back to the application code.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question