Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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?



Reply With Quote
  #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
Reply With Quote
  #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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.