473,661 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Stored Procs based on SQL Server Version

We have a product that we were experiencing high recompile rates do to
temp tables, we have re-written them to use table variables to reduce
recompile rate. The problem I am having is that we have some
customers still on SQL 7 where the table variables were not valid. I
would like to have one installation script that would create the
stored procedure with table variables on SQL Server 2000 and without
on SQL Server 7, I have been unsuccessful do to the limitation that
CREATE PROCEDURE statement cannot be in a script with any other
statements.

Was wondering if anyone else has run into this and found a way around
it.
Jul 20 '05 #1
1 1789
eyinkr (ey****@hotmail .com) writes:
We have a product that we were experiencing high recompile rates do to
temp tables, we have re-written them to use table variables to reduce
recompile rate. The problem I am having is that we have some
customers still on SQL 7 where the table variables were not valid. I
would like to have one installation script that would create the
stored procedure with table variables on SQL Server 2000 and without
on SQL Server 7, I have been unsuccessful do to the limitation that
CREATE PROCEDURE statement cannot be in a script with any other
statements.

Was wondering if anyone else has run into this and found a way around
it.


There is no built-in to SQL Server for handle this. However, you can
use a preprocessor. If you have Visual C++, the C preprocessor is
probably the most natural use. It goes without saying that there is
some work to package the preprocessor with your load process.

We have faced the same problem in our shop, although in our case it
was SQL 6.5 and SQL 2000 we needed to support. We didn't go for the
C preprocessor, but rather I wrote our own that was fully integrated
with the rest of our toolset for building and installing database
object. This preprocessor, named Preppis, is available as freeware
together with the rest of the toolset on http://www.abaris.se/abaperls/.

--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

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

Similar topics

1
460
by: LineVoltageHalogen | last post by:
Greetings All, currentley there is a heated discussion in my place of work over which method is better/more efficient for simple selects. Background: 1.) Simple Application that uses sql server for backened db. 2.) The application is only inserting and selecting data from the db. 3.) The developers want to use sp_executesql for simple selects and the dba's want to use a stored proc. >From my reading it seems that sp_executesql has a...
6
3088
by: Dave | last post by:
1) I know that we can define an external proc to be Fenced or NotFenced on "CREATE PROCEDURE" command. I don't see the FENCED / NOT FENCED option on "Create Procedure" for SQL stored procs. Is it always "NotFenced" for SQL stored procs by any chance ? We are in the process of migrating a SQL server app to DB2 with 2000 stored procs and the DB2 server keeps crashing too often during stored procs execution. 2) I have read somewhere...
3
1972
by: hrishy | last post by:
Hi Db2ers I am a newbie starting out in the fascinating world of IBM.Could anybody let me know in what version the sql /PL language was introduced..Can you also let me know what is the language that most stored procs are written using.. I am asking this question as i want to develop the ability to write stored procs..so just wunderin should i pick up fortran c c++ or sql pl.
16
2099
by: efiryago | last post by:
Since V8.2 does not require a C compiler to build SQL stored procedures, I am just wonderring how they are now implemented internaly as opposed to C embedded SQL before V8.2, so, basicaly, what happens by CREATE PROCEDURE LANGUAGE SQL statement (I noticed no C files get generated in $INSTHOME/sqllib/function/routine/sqlproc/database/schema directory as it was before)? Thanks, -Eugene
7
1718
by: trint | last post by:
My boss wants me to use stored procedures, but I thought somehow that using c# that ADO.Net was better. Any help is appreciated. Thanks, Trint
3
2151
by: NWx | last post by:
Hi, I write an ASP,NET application who uses SQL Server (MSDE) as Back-end I'm an experienced developer, but haven't used SQL server before and I need some help. Since I don't have full SQL server (but only MSDE), I don't have Enterprise manager. So I used Access XP (using an ADP file) to create the database on MSDE server (tables, views, stored procs etc)
45
3391
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
1
1709
by: kentk | last post by:
Is there a difference in how SQL Server 7 and SQL 2000 processes SQL passed from a program by an ADO command object. Reason I ask is I rewrote a couple applications a couple years ago were the SQL statements were inline. I basically took the SQL statements and put them into stored procs, were there were variables in the code I used SQL parameters in the stored procs. I got some amazing performance results by switching to stored procs. ...
8
2621
by: Frank Calahan | last post by:
I've been looking at LINQ and it seems very nice to be able to make queries in code, but I use stored procs for efficiency. If LINQ to SQL only works with SQL Server and stored procs are more efficient, what use is LINQ to SQL, other than to have a simpler way to call my stored proc?
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8758
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.