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.
Author |
Topic |
jasonlum
Starting Member
2 Posts |
Posted - 2011-01-20 : 18:04:12
|
Hi I would like to know how to import data from an Excel file into a table that has a primary key of type uniqueidentifier and is auto generated using the newid(). Following is the create table:CREATE TABLE [dbo].[Schools]( [SchoolId] [uniqueidentifier] NOT NULL CONSTRAINT DEFAULT (newid()), [SchoolName] [nvarchar](556) NOT NULL, [RegistrationNumber] [nvarchar](50) NULL) In my excel file, I have two columns: SchoolName and RegistrationNumber. There are about 5000 records to read.I tried using SSIS but could not figure out a way to reference the SchoolId field. Is there any working example that I can use as a reference with SSIS to do the job.ThanksJackson |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
jasonlum
Starting Member
2 Posts |
Posted - 2011-01-20 : 18:21:12
|
quote: Originally posted by tkizer Why do you want to use a GUID? Use an identity column instead. GUIDs are evil!Tara Kizer
My database will be used with other systems that connect to other databases so to avoid duplicated ids. |
|
|
|
|
|