R
Ray Valenti
I'm trying to create a SQL Server table via ado.net by running:
cmd.CommandType = CommandType.Text
cmd.CommandText = sql
cmd.ExecuteNonQuery()
Where:
SQL = "CREATE TABLE [DeracinateTemp]
([ID] [int] IDENTITY (1, 1) NOT NULL ,
....
[ContactDate] [datetime] NULL ,
CONSTRAINT [PK_DeracinateTemp] PRIMARY KEY CLUSTERED
(
[ID]()
) ON [PRIMARY]
) ON [PRIMARY]
I get the error:
Line 20: Incorrect syntax near '('.
System.Data.SqlClient.SqlException: Line 20: Incorrect syntax near '('.
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
line 20 is the [ID]() line.
This runs fine in Query Analyzer but not in ADO.net
Is a different syntax required from code?
Ray
cmd.CommandType = CommandType.Text
cmd.CommandText = sql
cmd.ExecuteNonQuery()
Where:
SQL = "CREATE TABLE [DeracinateTemp]
([ID] [int] IDENTITY (1, 1) NOT NULL ,
....
[ContactDate] [datetime] NULL ,
CONSTRAINT [PK_DeracinateTemp] PRIMARY KEY CLUSTERED
(
[ID]()
) ON [PRIMARY]
) ON [PRIMARY]
I get the error:
Line 20: Incorrect syntax near '('.
System.Data.SqlClient.SqlException: Line 20: Incorrect syntax near '('.
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
line 20 is the [ID]() line.
This runs fine in Query Analyzer but not in ADO.net
Is a different syntax required from code?
Ray