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.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 how to create a guid key and import data using DTS simutaneously

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-15 : 09:59:29
Phil writes "Hi,

I'm using windows 2k, sql server 2k console 1.2 service pack 2

I'm trying to create a guid key as a primary key on a table and import data from an excel spreadsheet into different columns on that same table. I have a table that has three columns; 2 are coming from excel dts import and I want to auto-generate guid key on that third column for each record. I've tried putting newID() in with this statement:


select `Sheet1$`.`UIN`, `Sheet1$`.`PeopleStatusID`
from `Sheet1$`


but it's not working... am I on the right track? Is this where I would put a guid column?

Thanks,
Phil"

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-03-15 : 14:28:10
Phil,

You could set NEWID() as the default value for your field in the destination table definition, and then don't specify anything to go into that field, SQL Server will insert it for you.

------------------------
GENERAL-ly speaking...

Edited by - AjarnMark on 03/15/2002 14:28:50
Go to Top of Page
   

- Advertisement -