[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

uniqueidentifier data type in MS SQL 2005

Posted on 2008-06-22
1
Medium Priority
?
2,614 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

650 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