Monday, March 19, 2012

.SQL file

I have install.sql, that i want to run...so I can add to my existing asp.net 2.0 project. How do can I add the table to my database using that file (contents below)? Database resides in SQL Server 2000.

create table[dbo].[CustomProfile](

[UserID] [uniqueidentifier]not null,

[FirstName] [nvarchar](25)not null,

[LastName] [nvarchar](25)not null,

[Address1] [nvarchar](75)not null,

[Address2] [nvarchar](75)null,

[City] [nvarchar](50)not null,

[State] [nvarchar](2)not null,

[Zip] [nvarchar](10)not null,

[Phone] [nvarchar](12)null,

[ProfileVersion] [int]not null,

[LastUpdatedDate] [datetime]not null

)on[PRIMARY]

alter table[dbo].[CustomProfile]add

constraint[PK_CustomProfile_UserProfile]primary key clustered

(

[UserID]

)with(IGNORE_DUP_KEY =OFF)on[PRIMARY]

Easiest way is to run it in the Query Analyzer. Open up SQL management tools, connect to the sevrver/db of your choice. Then you start the Query Analyzer (or new Query if it's 2005) from a menu. There you can paste the code and just click the green arrow to execute it. Voila!

|||

Thanks for the suggestion. However, I got the following error listed below. Any idea?

Msg 170, Level 15, State 1, Line 19

Line 19: Incorrect syntax near '('.

|||

I removed 'with(IGNORE_DUP_KEY =OFF)on[PRIMARY]'....and it worked. Is this not an SQL option?

Thanks again for your help.

|||

johram:

Easiest way is to run it in the Query Analyzer. Open up SQL management tools, connect to the sevrver/db of your choice. Then you start the Query Analyzer (or new Query if it's 2005) from a menu. There you can paste the code and just click the green arrow to execute it. Voila!

In a perfect world, perhaps...Wink

The OP is saying he needs to create the table on SQL 2000. The script wil fail at the end ".. WITH (IGNORE_DUP_KEY).. " part. This is 2005 syntax. I believe the script was generated from Management Studio connected to 2000 box?

No comments:

Post a Comment