Hi Brian,
 
if you make the changes in Enterprise Manager then click the 'generate scripts' button instead of clicking save it will generate the script you need.
 
Something like:
 
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
CREATE TABLE dbo.Tmp_tblTesting
 (
  intId int NOT NULL IDENTITY (1, 1),
 nvcCharColumn nvarchar(80) NULL
 ) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_tblTesting ON
GO
IF EXISTS(SELECT * FROM dbo.tblTesting)
  EXEC('INSERT INTO dbo.Tmp_tblTesting(intId, nvcCharColumn)
  SELECT intId, nvcCharColumn FROM dbo.tblTesting TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_tblTesting OFF
GO
DROP TABLE dbo.tblTesting
GO
EXECUTE sp_rename 'dbo.Tmp_tblTesting', 'tblTesting'
GO
ALTER TABLE dbo.tblTesting ADD CONSTRAINT
 PK_tblTesting PRIMARY KEY NONCLUSTERED
 (
 intId
 ) ON [PRIMARY]
GO
COMMIT
 
James
-----Original Message-----
From: KNOTT, Brian [mailto:[EMAIL PROTECTED]
Sent: Monday, 15 November 2004 9:52 AM
To: CFAussie Mailing List
Subject: [cfaussie] OT Microsoft SQL Server Help

Does anyone know of a good site / mailing list where I can ask SQL Server questions. 

 

I don't want to post them here as it's really a CF list.

 

Anyway, does any one know the SQL script to add a primary key to a table of change the length of a field from 80 chars to 200 chars.  I can do it via the enterprise manager but I need to script it to run on another server.

 

Brian Knott

 



-----------------------------------------------------------------------------------
This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its related entities ("Suncorp").

Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 13 11 55 or at suncorp.com.au.

The content of this e-mail is the view of the sender or stated author and does not necessarily reflect the view of Suncorp. The content, including attachments, is a confidential communication between Suncorp and the intended recipient. If you are not the intended recipient, any use, interference with, disclosure or copying of this e-mail, including attachments, is unauthorised and expressly prohibited. If you have received this e-mail in error please contact the sender immediately and delete the e-mail and any attachments from your system.

If this e-mail constitutes a commercial message of a type that you no longer wish to receive please reply to this e-mail by typing Unsubscribe in the subject line.
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to