![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
New to SQL server here, so if this has been asked, apologies in advance. Using DTS to convert a file, and running into a key problem creating the new file. The file has a two column primary key, and I'm not sure of the syntax to set this up as part of the DTS package. Books online says I can do this, but doesn't provide an example of one such. I know I can go back and set it manually, but it needs to be done at conversion time. Here's a sample of what I'm using, rightly or wrongly: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[aidfile]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[aidfile] CREATE TABLE [dbo].[aidfile] ( [AID_USER_ID] char (12) primary key, [AID_USER_PSWD] char (12), [AID_APP_UNQ_ID] int, etc etc The primary key is actually AID_USER_ID + AID_USER_PSWD, but I'm just not sure of the syntax to make this happen at conversion time. Can anyone help?? Thanks! -- Elaine Pack, Web Analyst Charlottesville, VA elaineATpackwebs.net |
#3
| |||
| |||
|
|
If you want to create a PK consisting of > 1 column then you have to do this at the table level so CREATE TABLE [dbo].[aidfile] ( [AID_USER_ID] char (12) NOT NULL, [AID_USER_PSWD] char (12) NOT NULL, [AID_APP_UNQ_ID] int PRIMARY KEY (AID_USER_ID,AID_USER_PSWD) ) -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "EPPack" <epack (AT) packwebs (DOT) net> wrote in message news:e4xTWLwoDHA.2444 (AT) TK2MSFTNGP09 (DOT) phx.gbl... New to SQL server here, so if this has been asked, apologies in advance. Using DTS to convert a file, and running into a key problem creating the new file. The file has a two column primary key, and I'm not sure of the syntax to set this up as part of the DTS package. Books online says I can do this, but doesn't provide an example of one such. I know I can go back and set it manually, but it needs to be done at conversion time. Here's a sample of what I'm using, rightly or wrongly: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[aidfile]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[aidfile] CREATE TABLE [dbo].[aidfile] ( [AID_USER_ID] char (12) primary key, [AID_USER_PSWD] char (12), [AID_APP_UNQ_ID] int, etc etc The primary key is actually AID_USER_ID + AID_USER_PSWD, but I'm just not sure of the syntax to make this happen at conversion time. Can anyone help?? Thanks! -- Elaine Pack, Web Analyst Charlottesville, VA elaineATpackwebs.net |
![]() |
| Thread Tools | |
| Display Modes | |
| |