Link to home
Start Free TrialLog in
Avatar of Adnan
AdnanFlag for Norway

asked on

Error running Sql script in win app

i get error message when i try to run my Sql script in my win app form.....

i get exception message saying thath:

'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Incorrect syntax near the keyword 'PROCEDURE'.
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Account_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Balance".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Account_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Type_Id".
Must declare the scalar variable "@Type_Id".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Client_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Client_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Engagement_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@MatchItem_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@FileType_ID".
Must declare the scalar variable "@FileType_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@ImpFile_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@MatchItem_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Engagement_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Engagement_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Reconciled_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@ReconType_ID".
Must declare the scalar variable "@ReconType_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Client_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Setting_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@MatchItem_ID".
Incorrect syntax near the keyword 'PROCEDURE'.
Must declare the scalar variable "@Type_ID".
Must declare the scalar variable "@Type_ID".
a USE database statement is not allowed in a procedure, function or trigger.
a USE database statement is not allowed in a procedure, function or trigger.

Do somone now how to fix this problom?
Avatar of Anurag Thakur
Anurag Thakur
Flag of India image

your are trying to create a procedure from your windows application
can you share your sql that you send from your windows application
Avatar of Adnan

ASKER

oki, the script is very big, i am atachied the script. the script is for seting up the database for kustomer running ouer win app...!
ASKER CERTIFIED SOLUTION
Avatar of Anurag Thakur
Anurag Thakur
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Adnan

ASKER

if i use Go in my script i get exception inncorect syntax near 'Go'...........
Avatar of Adnan

ASKER

Incorrect syntax near 'go'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'SET'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'SET'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'SET'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'SET'.
Avatar of Adnan

ASKER

if i run the script direct in sql server then it run ok, but not true the application...
found the issue
search for this
CREATE PROCEDURE [dbo].[RestoreAccess]

the above procedure and a lot of procedures are not being created as the procedures before that and you are getting error around this line i think

your create procedure line should be like this and not as its in the script file
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InsertMatchItemXtra]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N''
End
Avatar of Adnan

ASKER

oki, but i dident understand how i can fin my procedure......can you show me how nad what you are meaning by creating procedure like u sayd?
search for text create procedure in your script file and where create procedure does not preceed with the text as i mentioned in my previous comment you will have to make changes
I think all the procedures after the procedure CREATE PROCEDURE [dbo].[RestoreAccess] were like that (if i remember correctly)
Avatar of Adnan

ASKER

sorry ragi0017 i still do not understand, iam not so god in scripting and Database..... :(
Avatar of Adnan

ASKER

i made it... ;) thanks for helping...u guide me the right way
Avatar of modus_operandi
modus_operandi

Sample file removed.
 
modus_operandi
EE Moderator