Thursday, March 29, 2012

Create Table SQL 2000->2005

I have some simple sql that I use to create tables in a database in 2000. Have done it many times, many sql 2000 instances are fresh installs. Now on a 2005 fresh install it doesn't work<br>

USE MyDB
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE "care"."MyObjects"
(
"DId" integer NULL ,
"MyObjectID" integer NOT NULL ,
"idType" integer NULL ,
"name" varchar(64) NULL ,
"description" varchar(1024) NULL ,
CONSTRAINT "pk_MyObject" PRIMARY KEY NONCLUSTERED ("MyObjectID"),
)

go

I get "The specified schema name "care" either does not exist or you do
not have permission to use it."

I have used the db owner, sa both to try and create the tables using 90/Tools/Binn/OSQL.exe but no go. What am I missing ?

Thanks

The obvious answer is that the schema care does not exist. Schemas are now fully supported in SQL Server 2005, and no longer reflect the user in the pseudo implementation for SQL 2000. You may wish to read the relevant topics in Books Online and ensure you methods and usage of them is still appropriate.

Instead of using osql you may also wish to try using sqlcmd as this is the replacement going forwards.

No comments:

Post a Comment