Error When Creating Script To Copy Stored Procedures

Jan 16, 2007

Our DB has around 30 SProcs - I need to move them into a script, so that it can be easily added to another server. The way I'm creating the script is to highlight all the SProcs, then copy - in my notepad screen, I paste, which gives me one script, which includes all the individual creation scripts for the Sprocs.

 However, I'm getting an error when I create the script -

Cannot add rows to sysdepends for the current stored procedure because it depends on the missing object 'SP_MySproc'. The stored procedure will still be created.

So - what's a good, and/or easy way to structure the script, so that I can easily find WHERE to put Which SProc Script, in the list?

 

View 4 Replies


ADVERTISEMENT

Error Trying To Copy Stored Procedures From One Db To Another

Sep 8, 2004

Hello,

The export menu in DTS is a bit confusing for me. I have some stored procedures in one SQL Server and want to copy them to another. The username is the same for both SQL Servers. When I try copying the stored procedure with defaul settings, I get a progress bar (24 percent ccompleted, 62 percent completed...), then when its done it says "failed to copy objects from sql server to sql server". When I double click the error for details it says "User or role '[username]' already exists in the current database". Then I try again, unchecking "use default options" for my export. I go in to alter the options, uncheck "copy database users and database groups" (I've also tried unchecking "copy object-level permissions"), run it, get progress bar (like above), and then get another error that says "There is no such user or group '[username]'".

My user name is correct, I am able to access both Sql Servers with this username, and I should have all of the appropriate permissions.

I think maybe there is a checkbox I'm not unchecking or something stupid like that.

Thanks in advance for any feedback.

View 2 Replies View Related

SSMS-EE: Creating And Using Stored Procedures - Error Messages 111, 156, && 102

May 10, 2006

Hi all,

I tried to use the SSMS-EE Query to execute the following code statements:

--- SQLQuery.sql---

USE testDB
DECLARE @procID int
DECLARE @procName varchar(20)
DECLARE @procType varchar(20)
CREATE PROC sp_getRecords AS SELECT * FROM Inventory
CREATE PROC sp_insertRecord @procID int, @procName varchar(20), @procType
varchar(20) AS INSERT INTO Inventory VALUES (@procID, @procName, @procType)
CREATE PROC sp_deleteRecord @procID int AS DELETE FROM Inventory WHERE ID=@procID
CREATE PROC sp_updateRecord @procID int, @procName varchar(20), @procType
varchar(20) AS UPDATE Inventory SET name=@procName, type=@procType where ID=@procID
--- Insert records into the Inventory table
EXE sp_insertRecord 4, 'ER Vol 1', 'DVD'
EXE sp_insertRecord 5, 'ER', 'VHS'
EXE sp_insertRecord 6, 'Sixth Sense', 'DVD'
--- Delete record with ID=3
EXEC sp_deleteRecord 3
--- Update record with ID=5
EXEC sp-updateRecord 5 'ERVol1', 'VHS'
--- View the updated table
EXEC sp_getRecords
GO

//////////////////////////////////////////////////////////////////////////////////////////////////

I got the following error messages:
Msg 111, Level 15, State 1, Procedure sp_getRecords, Line 8
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 10
Incorrect syntax near the keyword 'PROC'.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 11
Incorrect syntax near the keyword 'PROC'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 14
Incorrect syntax near 'EXE'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 20
Incorrect syntax near 'updateRecord'.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Please help, tell me what is wrong in my execution of the code and advise me how I can correct this problem.
Thanks,
Scott Chang

View 1 Replies View Related

SSMS-EE: Creating And Using Stored Procedures - Error Messages 111, 156, && 102

May 11, 2006



Hi all,

I tried to use the SQL Server Managemet Studio-Express Edition to execute the following code statements:

--- SQLQuery.sql---

USE testDB
DECLARE @procID int
DECLARE @procName varchar(20)
DECLARE @procType varchar(20)
CREATE PROC sp_getRecords AS SELECT * FROM Inventory
CREATE PROC sp_insertRecord @procID int, @procName varchar(20), @procType
varchar(20) AS INSERT INTO Inventory VALUES (@procID, @procName, @procType)
CREATE PROC sp_deleteRecord @procID int AS DELETE FROM Inventory WHERE ID=@procID
CREATE PROC sp_updateRecord @procID int, @procName varchar(20), @procType
varchar(20) AS UPDATE Inventory SET name=@procName, type=@procType where ID=@procID
--- Insert records into the Inventory table
EXE sp_insertRecord 4, 'ER Vol 1', 'DVD'
EXE sp_insertRecord 5, 'ER', 'VHS'
EXE sp_insertRecord 6, 'Sixth Sense', 'DVD'
--- Delete record with ID=3
EXEC sp_deleteRecord 3
--- Update record with ID=5
EXEC sp-updateRecord 5 'ERVol1', 'VHS'
--- View the updated table
EXEC sp_getRecords
GO

//////////////////////////////////////////////////////////////////////////////////////////////////

I got the following T-SQL error messages:
Msg 111, Level 15, State 1, Procedure sp_getRecords, Line 8
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 10
Incorrect syntax near the keyword 'PROC'.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 11
Incorrect syntax near the keyword 'PROC'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 14
Incorrect syntax near 'EXE'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 20
Incorrect syntax near 'updateRecord'.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Please help, tell me what is wrong in my execution of the code and advise me how I can correct this problem.
Thanks,
Scott Chang

View 6 Replies View Related

SSMS-EE: Creating And Using Stored Procedures - Error Messages 111, 156, && 102

May 10, 2006

Hi all,

I tried to use the SSMS-EE Query to execute the following code statements:

--- SQLQuery.sql---

USE testDB
DECLARE @procID int
DECLARE @procName varchar(20)
DECLARE @procType varchar(20)
CREATE PROC sp_getRecords AS SELECT * FROM Inventory
CREATE PROC sp_insertRecord @procID int, @procName varchar(20), @procType
varchar(20) AS INSERT INTO Inventory VALUES (@procID, @procName, @procType)
CREATE PROC sp_deleteRecord @procID int AS DELETE FROM Inventory WHERE ID=@procID
CREATE PROC sp_updateRecord @procID int, @procName varchar(20), @procType
varchar(20) AS UPDATE Inventory SET name=@procName, type=@procType where ID=@procID
--- Insert records into the Inventory table
EXE sp_insertRecord 4, 'ER Vol 1', 'DVD'
EXE sp_insertRecord 5, 'ER', 'VHS'
EXE sp_insertRecord 6, 'Sixth Sense', 'DVD'
--- Delete record with ID=3
EXEC sp_deleteRecord 3
--- Update record with ID=5
EXEC sp-updateRecord 5 'ERVol1', 'VHS'
--- View the updated table
EXEC sp_getRecords
GO

//////////////////////////////////////////////////////////////////////////////////////////////////

I got the following error messages:
Msg 111, Level 15, State 1, Procedure sp_getRecords, Line 8
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 10
Incorrect syntax near the keyword 'PROC'.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 11
Incorrect syntax near the keyword 'PROC'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 14
Incorrect syntax near 'EXE'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 20
Incorrect syntax near 'updateRecord'.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Please help, tell me what is wrong in my execution of the code and advise me how I can correct this problem.
Thanks,
Scott Chang

View 1 Replies View Related

SSMS-EE: Creating And Using Stored Procedures - Error Messages 111, 156, && 102

May 11, 2006



Hi all,

I tried to use the SQL Server Managemet Studio-Express Edition to execute the following code statements:

--- SQLQuery.sql---

USE testDB
DECLARE @procID int
DECLARE @procName varchar(20)
DECLARE @procType varchar(20)
CREATE PROC sp_getRecords AS SELECT * FROM Inventory
CREATE PROC sp_insertRecord @procID int, @procName varchar(20), @procType
varchar(20) AS INSERT INTO Inventory VALUES (@procID, @procName, @procType)
CREATE PROC sp_deleteRecord @procID int AS DELETE FROM Inventory WHERE ID=@procID
CREATE PROC sp_updateRecord @procID int, @procName varchar(20), @procType
varchar(20) AS UPDATE Inventory SET name=@procName, type=@procType where ID=@procID
--- Insert records into the Inventory table
EXE sp_insertRecord 4, 'ER Vol 1', 'DVD'
EXE sp_insertRecord 5, 'ER', 'VHS'
EXE sp_insertRecord 6, 'Sixth Sense', 'DVD'
--- Delete record with ID=3
EXEC sp_deleteRecord 3
--- Update record with ID=5
EXEC sp-updateRecord 5 'ERVol1', 'VHS'
--- View the updated table
EXEC sp_getRecords
GO

//////////////////////////////////////////////////////////////////////////////////////////////////

I got the following T-SQL error messages:
Msg 111, Level 15, State 1, Procedure sp_getRecords, Line 8
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 10
Incorrect syntax near the keyword 'PROC'.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 11
Incorrect syntax near the keyword 'PROC'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 14
Incorrect syntax near 'EXE'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 20
Incorrect syntax near 'updateRecord'.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Please help, tell me what is wrong in my execution of the code and advise me how I can correct this problem.
Thanks,
Scott Chang

View 3 Replies View Related

SSMS-EE: Creating And Using Stored Procedures - T-SQL Error Messages 111, 156, && 102

May 10, 2006

Hi all,

I tried to use the SQL Server Management Studio-Express Edition to execute the following code statements:

--- SQLQuery.sql---

USE testDB
DECLARE @procID int
DECLARE @procName varchar(20)
DECLARE @procType varchar(20)
CREATE PROC sp_getRecords AS SELECT * FROM Inventory
CREATE PROC sp_insertRecord @procID int, @procName varchar(20), @procType
varchar(20) AS INSERT INTO Inventory VALUES (@procID, @procName, @procType)
CREATE PROC sp_deleteRecord @procID int AS DELETE FROM Inventory WHERE ID=@procID
CREATE PROC sp_updateRecord @procID int, @procName varchar(20), @procType
varchar(20) AS UPDATE Inventory SET name=@procName, type=@procType where ID=@procID
--- Insert records into the Inventory table
EXE sp_insertRecord 4, 'ER Vol 1', 'DVD'
EXE sp_insertRecord 5, 'ER', 'VHS'
EXE sp_insertRecord 6, 'Sixth Sense', 'DVD'
--- Delete record with ID=3
EXEC sp_deleteRecord 3
--- Update record with ID=5
EXEC sp-updateRecord 5 'ERVol1', 'VHS'
--- View the updated table
EXEC sp_getRecords
GO

//////////////////////////////////////////////////////////////////////////////////////////////////

I got the following T-SQL error messages:
Msg 111, Level 15, State 1, Procedure sp_getRecords, Line 8
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 10
Incorrect syntax near the keyword 'PROC'.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 11
Incorrect syntax near the keyword 'PROC'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 14
Incorrect syntax near 'EXE'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 20
Incorrect syntax near 'updateRecord'.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Please help, tell me what is wrong in my execution of the code and advise me how I can correct this problem.
Thanks,
Scott Chang

View 3 Replies View Related

SSMS-EE: Creating And Using Stored Procedures - Error Messages 111, 156, && 102

May 10, 2006



Hi all,

I tried to use the SQL Server Managemet Studio-Express Edition to execute the following code statements:

--- SQLQuery.sql---

USE testDB
DECLARE @procID int
DECLARE @procName varchar(20)
DECLARE @procType varchar(20)
CREATE PROC sp_getRecords AS SELECT * FROM Inventory
CREATE PROC sp_insertRecord @procID int, @procName varchar(20), @procType
varchar(20) AS INSERT INTO Inventory VALUES (@procID, @procName, @procType)
CREATE PROC sp_deleteRecord @procID int AS DELETE FROM Inventory WHERE ID=@procID
CREATE PROC sp_updateRecord @procID int, @procName varchar(20), @procType
varchar(20) AS UPDATE Inventory SET name=@procName, type=@procType where ID=@procID
--- Insert records into the Inventory table
EXE sp_insertRecord 4, 'ER Vol 1', 'DVD'
EXE sp_insertRecord 5, 'ER', 'VHS'
EXE sp_insertRecord 6, 'Sixth Sense', 'DVD'
--- Delete record with ID=3
EXEC sp_deleteRecord 3
--- Update record with ID=5
EXEC sp-updateRecord 5 'ERVol1', 'VHS'
--- View the updated table
EXEC sp_getRecords
GO

//////////////////////////////////////////////////////////////////////////////////////////////////

I got the following T-SQL error messages:
Msg 111, Level 15, State 1, Procedure sp_getRecords, Line 8
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 10
Incorrect syntax near the keyword 'PROC'.
Msg 156, Level 15, State 1, Procedure sp_getRecords, Line 11
Incorrect syntax near the keyword 'PROC'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 14
Incorrect syntax near 'EXE'.
Msg 102, Level 15, State 1, Procedure sp_getRecords, Line 20
Incorrect syntax near 'updateRecord'.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Please help, tell me what is wrong in my execution of the code and advise me how I can correct this problem.
Thanks,
Scott Chang

View 1 Replies View Related

Copy? Export? How To Copy Stored Procedures

Aug 30, 2005

How do I transfer/copy the stored procedures in my Test DB to my LIVE DB?  IT won't allow me to export keeps giving me an error. 

View 4 Replies View Related

Copy Stored Procedures From SQL To SQL DE?

Jan 31, 2007

Is there an easy way to copy all stored procedures from an SQL server to en SQL Desktop Engine or do I have build all stored procedures by hand?

View 2 Replies View Related

Copy Stored Procedures From 1 DB To Another DB

Apr 3, 2004

I need to copy the stored procedures from a database on one server to another. I used 121 WAM to copy the DB tables over but don't know how to copy the stored procedures over.

Can someone point me in the right direction?

Ultimately, what I would like to do is have the 2nd server update from the 1st server so I can set up a redundant DB.

Thank you for your help in advance.

Joel

View 1 Replies View Related

Copy Stored Procedures From SQL 6.5 To SQL 7.0

Jun 7, 2000

Does anyone know the right way to copy the Stored Procedures from SQL 6.5 to SQL 7.0?

Thanks in advance!

View 1 Replies View Related

How To Copy Some Tables, Stored Procedures

Feb 14, 2008

hi I'm working in VS2005 with SQL server Express database.How can I copy some tables, stored procedures and diagrams from one database to another? thanks 

View 3 Replies View Related

Is There A Way To Copy Whole Stored Procedures To Another Database?

Mar 1, 2008

is there a way to copy whole stored procedures to another database?
 I have aproximately 80 SPs in a database, I want to copy whole SPs into another DB. Is there a practical way to copy them?
Thanks

View 2 Replies View Related

Copy DB Tables And Stored Procedures To A New DB With Different Name

Feb 14, 2006

Hello all!
What I need to do is take a site that I have and make 3 copies of it so I will have 4 separate sites with 4 separate DB's but running on the same server. One of the sites is complete but what I need to know is how do I make a complete copy of the DB including all stored procedures and populate a blank DB that has a different name with contents from the master DB???
So if DB1 is complete and I want to now populate DB2, DB3 and DB4 with everything from DB1 (tables, stored procedures, data etc.) what would be the best way to do this?
The new sites are already setup in IIS and I have already transferred the files to each sites root, so all that is left is to setup the new DB's. They are all running on the same server… I think that is about everything someone would need to know to help me!
Any help would be greatly appreciated!!!

View 3 Replies View Related

Copy Stored Procedures To Another Database

Jul 20, 2005

I have 2 databases, one that we use called MyShop and one that I develop oncalled TestShop.After I have a stored procedure working the way I want in TestShop , isthere a way to just copy the SP to the other database without the copy andpaste method?. Same if I have a new table. Any way to add it in withoutrecreating it in the MyShop database?I am using Sql Server 2000ThanksAndy

View 1 Replies View Related

T-SQL Commands To Copy Files && Stored Procedures

Mar 20, 2008

I am looking to implement a system whereby a given user can 'authorise' changes to the system itself and promote from test to live.
For instance a user might be running an application which has a SQL 2005 database DataA opena nd runnign stored procedures from that.   I'd like a Stored procedure in that able to copy over a given stored procedure from a different database - DataB and copy into DataA.  Is that possible?
Also is it possible from T-SQL to copy files on the servers underlying filesystem?  Ie to copy some .aspx files from one location to another.
Regards
Clive
 
 

View 12 Replies View Related

Stored Procedures Are Not Creating

Dec 4, 2001

I want to create a replication on PUBS database between the servers "DENVER" and "VANCOUVER". I created a publication on "DENVER" using SALES table of PUBS database. In the properties of publication, I selected all the options of "Subscription creation and synchronization" under "Subscription options".

Then I created a pull subscription on "VANCOUVER" using PUBS database. As data of SALES table is same in both servers and also I want to use subscribers schema and data, I chose the option "No, the subscriber already has the schema and data" for initializing subscription. Now the problem is when I do updations in sales table, subscription is returning error "Could not find stored procedure 'sp_MSupd_sales'". I was found that subscription is not creating any of the stored procedure that is needed for subscribing from publication. Please help me to solve this problem.

Thanking You all,

Vishnu

View 1 Replies View Related

Creating Stored Procedures

Apr 23, 2008



Hi,All,I want to create a stored procedure,it should accept two input parameters one is General variable and other one is Table name.
How to pass table name as a input parameter.
I have created following one,but giving error.

CREATE PROC SP_VOTERSLIPS @BOOTHID VARCHAR(14),@TABLENAME VARCHAR(255)
AS
BEGIN
SELECT V.BOOTHID,B.BOOTHNAME,B.BOOTHADDR1,B.BOOTHADDR2,B.ENGBOOTHADDR1,B.ENGBOOTHADDR2,C.CONSSTUTIONNAME,V.SNO,V.HOUSENO,V.VOTERNAME,
V.GUARDIANTITLE,V.GUARDIANNAME,V.GENDER,V.AGE,V.VOTERIDNUMBER FROM @TABLENAME V LEFT JOIN TBLBOOTH B ON (B.BOOTHID=V.BOOTHID) LEFT JOIN
TBLCONSTTUTION C ON (C.CONSSTUTIONID=V.CONSSTUTIONID) WHERE B.BOOTHID=@BOOTHID
END


Error is :Must declare the variable '@TABLENAME'.

Pls Help me,it is urgent.

View 5 Replies View Related

Make A Copy Of SQL DB And Update/change Stored Procedures

Oct 10, 2006

Can I make a copy of my development database DEV on same SQL SERVER machine, rename it to TEST and stored procedures to be updated automatically for statements likeUPDATE [DEV].[dbo].[Company]SET [company_name] = @company_nameto becomeUPDATE [TEST].[dbo].[Company]SET [company_name] = @company_namein order not to edit each individual stored procedure for updating it ?

View 2 Replies View Related

Creating Stored Procedures In Sql Server

Jul 2, 2007

I just installed sql server 2005 on my machine.  I've been using Access for some time and have created my stored procedures easily in it.  However, this sql server 2005 is so complicated.  In Access, all I had to do was "Create a New Query", write my sql statement, name and save it.   However, I am having so much trouble with this sql server.  For example, when I create a stored procedure in sql server, it has a .sql extension.  I am assuming the stored procedure is a file.  However, after saving it, I expand my database, expand programmability, and expand stored procedures, yet my new stored procedure is not there.  It's placed in a file called projects.  I need to access this stored procedure from code, but in visual studio, I get an error message, "Cannot find stored procedure sp_Roster".  Here is the code I used to access my stored procedure from vb.net.  I thought it would work but it didntDim comm As New SqlCommandDim strsql As StringDim strconn As String        strsql = "sp_Roster"        strconn = "server=Home; user=sa; pwd=juwar74; database=Book;"        With comm            .Connection = New SqlConnection(strconn)            .CommandText = strsql            .CommandType = CommandType.StoredProcedure            With .Parameters.Add("TeacherID", SqlDbType.Char)                .Value = "DawsMark@aol.com"            End With            With .Parameters.Add("ClassID", SqlDbType.Int)                .Value = CInt(classid)            End With            With .Parameters.Add("sID", SqlDbType.Int)                .Value = ssID            End With            With .Parameters.Add("sLastName", SqlDbType.Char)                .Value = lastname            End With            With .Parameters.Add("sFirstName", SqlDbType.Char)                .Value = firstname            End With            With .Parameters.Add("sMiddleName", SqlDbType.Char)                .Value = middlename            End With            With .Parameters.Add("Student", SqlDbType.Char)                .Value = fullname            End With            With .Parameters.Add("Password", SqlDbType.Char)                .Value = password            End With            .Connection.Open()            .ExecuteNonQuery()            With comm.Connection                If .State = ConnectionState.Open Then                    .Close()                End If            End With        End With Here is my procedure that I created and that was saved as sp_Roster.sql in sql server CREATE PROCEDURE sp_Roster     ASBEGIN       SET NOCOUNT ON;    -- Insert statements for procedure here    INSERT INTO Roster (TeacherID, ClassID, sID, sLastName, sFirstName, sMiddleName, Student, Password) VALUES (@TeacherID, @ClassID, @sID, @sLastName, @sFirstName, @sMiddleName, @Student, @Password)ENDGO Why isn't ado.net finding it in sql server.  Is the sqlstr correct?  

View 2 Replies View Related

Creating Multiple Stored Procedures At Once

May 1, 2008

Hey

I am creating a database application that is accessed through a .NET front end.
What I want to do is run a SQL script that will create my DB, create my indexes and enforce my constraints (all of which I have done) but I also want to create my stored procedures in the same script also.

When I merge all my stored procedures (about 16) into one file and run it in SQL Query Analyzer I get multiple errors but the one that is coursing me the most bother is

‘Server: Msg 156, Level 15, State 1, Procedure procedureName, Line 134
Incorrect syntax near the keyword 'procedure'.’

What does this mean and why can’t I run more than once Stored Procedure at once?


Many thanks

Quish

View 2 Replies View Related

Creating Charts Using Stored Procedures

Jul 21, 2006

Hi all,

I want to create charts(pie/bar) using stored procedures for the table record values in sql server 2005 express edition.

plz help me for the above topic

Thanks & Regards,
Srinivas

View 6 Replies View Related

Creating Multiple Stored Procedures In One Go.

Feb 25, 2008



I have 50-60 stored procedures in my application and these are stored in different files as per file one stored procedudre.

I want to deploy my applicaiton. I want to create a batch or Single SQL file to create all stored precodures in on go.

My objective is to ensure that No stored procedure has left while deploying the applicaiton.

thanks.

View 3 Replies View Related

Creating Multiple Stored Procedures At Once

May 1, 2008

Hey

I am creating a database application that is accessed through a .NET front end.
What I want to do is run a SQL script that will create my DB, create my indexes and enforce my constraints (all of which I have done) but I also want to create my stored procedures in the same script also.

When I merge all my stored procedures (about 16) into one file and run it in SQL Query Analyser I get multiple errors but the one that is coursing me the most bother is

€˜Server: Msg 156, Level 15, State 1, Procedure procedureName, Line 134
Incorrect syntax near the keyword 'procedure'.€™

What does this mean and why can€™t I run more than once Stored Procedure at once?


Many thanks

Quish

View 9 Replies View Related

Creating SQL Server Stored Procedures In Deployment

Sep 20, 2007

Hey guys,I'm having a problem. I've been given a task to complete. I was given a database, and asked to wrap a website around it with certain functionality. I did this, and added seven stored procedures in the proccess. Everything works, Business Logic Layer, Data Access Layer, error validation, even screwed around with SQL-injection protection. Lovely, yes?However, when my little website gets tested, it's going to be plugged into a fresh database - the exact same database I was given, only with different data in the tables. My stored procedures won't be in that database. I can detect if my stored procedure doesn't exist easily enough by catching the error at runtime and checking the code. I would like to create the stored procedure inside that catch block. I just don't know how.The easy answer is just to use embedded SQL in my application instead of stored procedures. This isn't a commercial application, it's just a task I've been given to test my abilities. But embedded SQL is icky. I'd rather do it properly.

View 1 Replies View Related

Creating Extended Stored Procedures In C Sharp ?

Apr 26, 2004

Is it possible to create an extended stored procedure in C Sharp.
This is for Sql Server 2000.

Books online mentions that you have to use c / c++ to create an extended stored procedure.
However have Microsoft added any support so that the same thing can be done through a simpler language like C Sharp.

Thanks,
Alok.

View 1 Replies View Related

Creating Stored Procedures In SQL Server 2000

Dec 12, 2006

sivanantham writes "How to create Stored Procedures in SQL Server 2000?

also give me samples with Cursors and all

Thanks
Sivanantham"

View 4 Replies View Related

Creating Stored Procedures Based On Variables

Oct 5, 2006

Hi There,

I would like to know if for example i have some tables in my DataBase and i need from each table to get for instance, the Name by the ID, how can i make only one procedure which use parameters and variables so i can use this SP to get the Name By ID for all the Tables?

Thanks

View 1 Replies View Related

Copy Wizard Gives Error Creating Share

May 19, 2004

When I run the database copy wizard I'm getting an error creating shared omwwize.

The source server is 7.0. The destination server is 2000. I'm invoking the wizard from the 2000 machine.

Anybody know what this error means?

Thanks
Sharon

View 1 Replies View Related

How To Copy Sql Express Tables && Stored Procedures Into Remote Full Sql Server 2005

Feb 13, 2006

Hi all,
I am using Visual web developper 2005 with sql server express 2005 and i have also sql server management studio express. it's all free now .
my web site is ready
I didn't have problem to upload my site to my hoster.
Now I want to upload all my tables and my stored procedure create locally with VWD express
How can i do it ?
NB: I know i can't design DB (create/modify tables and stored proc) with express edition
thank's for your help

View 1 Replies View Related

MSSQL 7 Replication - Creating Of Standard Sp_MS... Stored Procedures

Aug 15, 2001

I am running MS SQL Server 7 with SP3 installed and am having some problems getting replication to work correctly. I want to replicate all tables from one database to another database on the same server. I can setup replication, add publications and add subscriptions without any problem and all goes well until the replication process starts when the job aborts because it cannot find the sp_MSins..., sp_MSupd... or the sp_MSdel... stored procedures. I have used the New Publication wizard to create a Transactional publication, published all tables and allowed the wizard to use the default stored procedures which it says will be created when the subscribers are initialized but although I have created push subcriptions the stored procedures are never created and hence the replication fails whenever the job runs.

I have SA access to the databases concerned and as far as I am aware the jobs are running as my login - can anybody help me out as this is beginning to drive me nuts.

Thanks

Chris

View 1 Replies View Related

Creating CSV Files Using BCP && Stored Procedures:BCP Executed From T-SQL Using Xp_cmdshell-How To Declare The Scalar Variable @@

Jan 24, 2008

Hi all,

I tried to create a CSV file using Bulk Copy Program (BCP) and Stored Procedures: BCP executed from T-SQL using xp_cmdshell. I have the following sql code executed in my SQL Server Management Studio Express and error message:


--scBCPcLabResults.sql--

declare @sql varchar(8000)
select @sql = 'bcp ChDbLabResults out
c:cpChDbLabResults.txt -c -t, -T -S' + @@.SQLEXPRESS
exec master..xp_cmdshell @sql

Msg 137, Level 15, State 2, Line 3
Must declare the scalar variable "@@".

=========================================================================================
--scBCPcLabResults.sql--

declare @sql varchar(8000)
select @sql = 'bcp ChDbLabResults out
c:cpChDbLabResults.txt -c -t, -T -S' + @@SQLEXPRESS
exec master..xp_cmdshell @sql

Msg 137, Level 15, State 2, Line 3
Must declare the scalar variable "@@SQLEXPRESS".

===================================================================

I copied this set of code from a tutorial article that says "@@servername". My Sql Server is SQLEXPRESS, so I put @@.SQLEXPRESS or @@SQLEXPRESS in the code of scBCPcLabResults.sql.
I do not know why I got an error {Must declare the scalar variable "@@"} or {Must declare the scalar variable "@@SQLEXPRESS"}!!!??? Please help and advise me how to solve this problem.

Thanks in advance,
Scott Chang

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved