November 16, 2009 at 7:25 am
HI all - I am wanting to set the backup name of the database in a variable to be used later in an execute SQL task when using a datbase backup task. Can anyone tell me how to do this? I have added a variable but not been able to get the expression to work.
Thanks
November 16, 2009 at 8:01 am
what expression/pattern you want to use.
One expression that I use is date_dabname. I use following query in SQL task and then assign the output to the variable:
select convert(varchar(10),getdate(),112) + '_' + DB_NAME()
-Vikas Bindra
November 16, 2009 at 9:07 am
HI thanks for the reply. I think I need more basic help than this, how do I populate the variable?
November 16, 2009 at 9:46 am
I am giving you steps for connection type ADO.Net
1. Create a Execute SQL task.
2. In general tab select the connection type ADO.Net, select/create new connection in the connection option.
3. In the SQLStatement option write the following query: select convert(varchar(10),getdate(),112) + '_' + DB_NAME() + '.bak'
4. in the result option select Single row.
5. Go to the Result set tab click on Add button and then say 0 in the Result Name and select your Variable name from the drop down in the Variable Name option.
And you have the variable set....Now you can use your variable in the next back up task.
-Vikas Bindra
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply