Adnan
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?
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
if i use Go in my script i get exception inncorect syntax near 'Go'...........
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'.
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'.
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].[InsertM atchItemXt ra]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N''
End
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].[InsertM
BEGIN
EXEC dbo.sp_executesql @statement = N''
End
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)
I think all the procedures after the procedure CREATE PROCEDURE [dbo].[RestoreAccess] were like that (if i remember correctly)
ASKER
sorry ragi0017 i still do not understand, iam not so god in scripting and Database..... :(
ASKER
i made it... ;) thanks for helping...u guide me the right way
Sample file removed.
modus_operandi
EE Moderator
modus_operandi
EE Moderator
can you share your sql that you send from your windows application