I have a requirement to delete a table in Sql server after a job finishes successfully.
I can do this with execute command stage.
Can anyone help with the syntax of the connection details. i tried the below it does not work
delete from Datamart.dbo.sample ;| userid/pwd@servername
Delete statement in Execute command stage
Moderators: chulett, rschirm, roy
Re: Delete statement in Execute command stage
This is not the way to execute the command.
Type sqlcmd/? in your command prompt for options
You are trying to execute it from execute command, but is there is any specific reason to execute it from sequence?
To delete a table there are good number of ways to do that! For example in the SQL Server stage itself there is are options to execute the DELETE statement in the Properties --> Option.
Code: Select all
sqlcmd -S Database-U Userid -P Password .....and so on
You are trying to execute it from execute command, but is there is any specific reason to execute it from sequence?
To delete a table there are good number of ways to do that! For example in the SQL Server stage itself there is are options to execute the DELETE statement in the Properties --> Option.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Thanks for your reply.
I tried to execute the command
sqlcmd -S servername -U userid -P pwd delete from DatabaseA.TablenameA;
it throws a error:
'sqlcmd' is not recognized as an internal or external command,operable program or batch file.
My reqt is : Query a table A in Database A and load to table B in Database B.
After successful load to table B in Database B. the table A has to be truncated.
What are the ways to acheive this?
I tried to execute the command
sqlcmd -S servername -U userid -P pwd delete from DatabaseA.TablenameA;
it throws a error:
'sqlcmd' is not recognized as an internal or external command,operable program or batch file.
My reqt is : Query a table A in Database A and load to table B in Database B.
After successful load to table B in Database B. the table A has to be truncated.
What are the ways to acheive this?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yes, do as Ray said.suja.somu wrote:the table A has to be truncated.
What are the ways to acheive this?
Just a clarification.
Initially you asked a question to delete a table and not to truncate
![Smile :)](./images/smilies/icon_smile.gif)
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Google the same word "how to...." you will get the answer .suja.somu wrote:how to set the path environment variable ?
As suggested you search in your machine for sqlcmd or right click the SQL Server in the all programes will let you know where it is installed. Then go to that Drive and find.
Once you found, then give the full path ( if env is not set) of sqlcmd /?. This will tell you what all are the option available!
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.