473,324 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

SQL Server 2005 Script Generation

I recently generated a script using SQL Server 2005 for a local
database that is configured as SQL Server 2000. Nevertheless, the
script used the new structures and syntax (i.e., sys.objects vs.
sysobjects). Is there a way that I can force SQL Server 2005 to use
the old 2000 syntax? I notice that when I script objects on a remote
SQL Server 2000 machine, it does use the old syntax.

Bill E.

Jul 18 '06 #1
11 5415
(bi********@netscape.net) writes:
I recently generated a script using SQL Server 2005 for a local
database that is configured as SQL Server 2000. Nevertheless, the
script used the new structures and syntax (i.e., sys.objects vs.
sysobjects). Is there a way that I can force SQL Server 2005 to use
the old 2000 syntax? I notice that when I script objects on a remote
SQL Server 2000 machine, it does use the old syntax.
If you use Tasks->Generate Scripts you will arrive at an options dialog
where you can select SQL 2000 syntax. If you script individual objects
directly from Object Explorer, there is no way to set options.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 18 '06 #2
Erland,

I selected the SQL Server 2000 option, but I'm still getting script
that looks like it was made for SQL Server 2005. Are you able to make
this work?

Bill

Jul 19 '06 #3
(bi********@netscape.net) writes:
I selected the SQL Server 2000 option, but I'm still getting script
that looks like it was made for SQL Server 2005. Are you able to make
this work?
Yes. I did not actually try to run the script on SQL 2000, so there may
still be glitches. But I did get things like:

IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
OBJECT_ID(N'[dbo].[language_rule]') AND OBJECTPROPERTY(id, N'IsRule') = 1)
EXEC dbo.sp_executesql N'
CREATE RULE [dbo].[language_rule] AS @x IN (''E'', ''S'') OR @x IS NULL
'
GO

which it would not say on SQL 2005.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 19 '06 #4
I just ran the script generator on a single table using the SQL 2000
option and here's what it produced:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[IF_Parameters]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[IF_Parameters](
[Param_Name] [varchar](50) NOT NULL,
[Param_Value] [real] NULL,
CONSTRAINT [PK_IF_Parameters] PRIMARY KEY CLUSTERED
(
[Param_Name] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END

Here's the script using the SQL 2005 option

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[IF_Parameters]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[IF_Parameters](
[Param_Name] [varchar](50) NOT NULL,
[Param_Value] [real] NULL,
CONSTRAINT [PK_IF_Parameters] PRIMARY KEY CLUSTERED
(
[Param_Name] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END

It looks the same to me.

Bill

Jul 19 '06 #5
hi Bill,
bi********@netscape.net wrote:
I recently generated a script using SQL Server 2005 for a local
database that is configured as SQL Server 2000. Nevertheless, the
script used the new structures and syntax (i.e., sys.objects vs.
sysobjects). Is there a way that I can force SQL Server 2005 to use
the old 2000 syntax? I notice that when I script objects on a remote
SQL Server 2000 machine, it does use the old syntax.
try having a look at http://www.sqlteam.com/publish/scriptio/ and or my
amScript at http://www.asql.biz/en/Download2005.aspx
they are both free..
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.19.0 - DbaMgr ver 0.63.0 and further SQL Tools
--------- remove DMO to reply
Jul 19 '06 #6
Andrea,

Thank you. I'll take a look.

Bill

Andrea Montanari wrote:
hi Bill,
bi********@netscape.net wrote:
I recently generated a script using SQL Server 2005 for a local
database that is configured as SQL Server 2000. Nevertheless, the
script used the new structures and syntax (i.e., sys.objects vs.
sysobjects). Is there a way that I can force SQL Server 2005 to use
the old 2000 syntax? I notice that when I script objects on a remote
SQL Server 2000 machine, it does use the old syntax.

try having a look at http://www.sqlteam.com/publish/scriptio/ and or my
amScript at http://www.asql.biz/en/Download2005.aspx
they are both free..
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.19.0 - DbaMgr ver 0.63.0 and further SQL Tools
--------- remove DMO to reply
Jul 19 '06 #7
Andrea,

I downloaded and tried your tool. It looks like this will be very
useful to me. I still had to "doctor" the script a bit, but it wasn't
too bad. This is much appreciated.

Bill

Jul 19 '06 #8
hi Bill,
bi********@netscape.net wrote:
Andrea,

I downloaded and tried your tool. It looks like this will be very
useful to me. I still had to "doctor" the script a bit, but it wasn't
too bad. This is much appreciated.
thank you, and please feel free to (privately) contact me for any question
or concern, as here we'd be OT and Erland would (correctly) beat us (:D)
thank you
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.19.0 - DbaMgr ver 0.63.0 and further SQL Tools
--------- remove DMO to reply
Jul 19 '06 #9
(bi********@netscape.net) writes:
I just ran the script generator on a single table using the SQL 2000
option and here's what it produced:
And did you run it through Tasks->Generate Scripts? I tried to script a
single table that way, and I the script did not refer to sys.objects..

You do have SP1 of SQL 2005 installed?

I know that I've seen bug reports about script generation in this area,
but I can't recall exactly what, nor if there were any fixes in SP1.

But if the tools that Andrea pointed you to works, I guess the point is
moot by now.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 19 '06 #10
Erland,

Yes, I used Tasks->Generate Scripts. I don't think that I have SP1
installed. My version shows 9.00.1399.00 for SQL Server Mgmt. Studio.

Bill

Jul 21 '06 #11
(bi********@netscape.net) writes:
Yes, I used Tasks->Generate Scripts. I don't think that I have SP1
installed. My version shows 9.00.1399.00 for SQL Server Mgmt. Studio.
That's indeed the RTM version. I suggest that you download SP1 and try
again.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 21 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: GB | last post by:
Okay, here is what I am trying to do We have a dialog of windows that collects information for generation of a dynamic HTML report. The last page in the wizard dialog accepts all report options...
2
by: Kevin R | last post by:
I'm trying to get asp.net 1.1 running on my home PC. When I try creating a new ASP.NET Web Application in 'Visual Studio .NET 2003' I get the following error: "Visual Studio .NET has detected...
6
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you...
1
by: bob.ward | last post by:
I attempted to upgrade to SQL Server 2000 from SQL Server 6.5 using the SQL Server Upgrade Wizard and I immediately received the following error message: An unknown error occurred while trying...
1
by: Myster Edd | last post by:
I have a strange problem that I think deals with security on SQL 2005. I have a scheduled task that runs on a Windows 2000 machine. It calls a vb script which creates a connection to SQL Server. ...
2
by: Graville | last post by:
All, OK wasn't sure where to post this one but this should hopefully be ok. I am looking for a way to streamline some of the process within our dev team. One of the areas that often takes time...
10
by: =?Utf-8?B?UHVuaXQgS2F1cg==?= | last post by:
Hi, I am developing a windows application in VS.NET 2005. The application is database driven and I need to deploy it on a client's pc. How should I go about developing such an application. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.