Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 29th, 2007, 05:17 PM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why do i get erro when alter table command in ms s

hi,
i have created this table in ms sql 2000

CREATE TABLE [Cmm_Category] (
[CatID] [int] IDENTITY (1, 1) PRIMARY KEY CLUSTERED NOT NULL ,
[CatName] [nvarchar] (50) NULL ,
[CatImage] [varchar] (50) NULL ,
[CatFolder] [nvarchar] (50) NULL ,
[Active] [bit] default (1) NULL
) ON [PRIMARY]
GO

but when i export it to my remote server the index of catid and identity field is removed and when i try to modify the table with the syntax below i get erro
Incorrect syntax near '('

alter TABLE [Cmm_Category] Modify (
[CatID] [int] IDENTITY (1, 1) PRIMARY KEY CLUSTERED NOT NULL ,
[CatName] [nvarchar] (50) NULL ,
[CatImage] [varchar] (50) NULL ,
[CatFolder] [nvarchar] (50) NULL ,
[Active] [bit] default (1) NULL
) ON [PRIMARY]
GO


is there any way to set the primary key and identity without recreaing the field?



  #2 (permalink)  
Old June 30th, 2007, 12:29 AM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

When you say you "export it to my remote server", do you mean you are using "replication" to do the export? If so, you're out of luck... "replication" will not pass the IDENTITY property to the table on the remote server.

Pretty sure that SELECT/INTO won't do it across servers, either.

--Jeff Moden
  #3 (permalink)  
Old June 30th, 2007, 02:06 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no i use export wizard to export my tables to remote host but in this way my primary keys are dropped



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to alter shell command to direct where window dgr7 Beginning VB 6 4 March 16th, 2007 02:00 PM
"ALTER USER.." command problem Dmitriy Oracle ASP 0 October 23rd, 2006 12:24 PM
Help on 'Alter Table' command charuni Classic ASP Basics 0 April 14th, 2006 11:14 AM
Chapter-13-direct SQL command-ExecuteNonQuery erro lionking BOOK: Beginning ASP.NET 1.0 3 May 13th, 2004 10:42 PM
Chapter-13-direct SQL command-ExecuteNonQuery erro softdev BOOK: Beginning ASP.NET 1.0 6 February 22nd, 2004 07:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.