SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE CreateTableNewTable
AS
SET NOCOUNT ON
CREATE TABLE NewTable
(
UID\t\tbigint\t\tIDENTITY (1,1) PRIMARY KEY,
RecordType\t\t\tchar(2)\t\tNOT NULL,
RecSequenceNumber\t\tint\t\tNOT NULL,
TicketNumber\t\t\tvarchar(15)\tNOT NULL,
TicketNumberCheckDigit\t\tchar(1)\t\tNOT NULL,
RecordDate\t\t\tdatetime\tNOT NULL,
FileDate\t\t\tdatetime\tNOT NULL,
TransmissionControlNumber\tvarchar(15)\tNULL,
TCNCheckDigit\t\t\tchar(1)\t\tNULL,
OriginalRecord\t\t\tvarchar(450)\tNULL
\t)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
I've used it multiple times as a template to make dozens of tables. Well, guess what? SQL Server 2000 decided that, on the average, 1 out of every 2 times I used it -- the primary key WAS NOT CREATED.
No error messages, no warnings, no nothing. SQL Server made me think that every worked as expected. And yet it didn't.
Any suggestions on how to modify the syntax so that the primary key gets created every time that I use this stored procedure format?