Solved

uniqueidentifier data type in MS SQL 2005

Posted on 2008-06-22
1
2,594 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
1 Comment
 
LVL 142

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL: Episode III - Revenge of The Dude 24 53
SQL Server Designer 19 44
sql server concatenate fields 10 36
Create snapshot on MSSQL 2012 3 20
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

803 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