Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2008-11-18 : 07:05:01
|
Am trying to create aa folder so i can copy file into each week as part of a job step. The code runs ok for me but i don;t get a new folder any ideas why ?use [master]declare @MD varchar(100), @Path varchar(100),@wk_no varchar(2)set @wk_no = datepart(wk,getdate())--print @wk_noSET @Path = 'E:\FlatFiles\BCP\Data\'SET @MD = 'mkdir' + @Path +'WK' + @wk_noEXEC xp_cmdshell @MD, no_output |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-11-18 : 07:38:50
|
Always easier to debug if you print your dynamic sql before you execute it. You had no space between mkdir and path.use [master]declare @MD varchar(100), @Path varchar(100),@wk_no varchar(2)set @wk_no = datepart(wk,getdate())--print @wk_noSET @Path = 'E:\FlatFiles\BCP\Data\'SET @MD = 'mkdir ' + @Path +'WK' + @wk_noEXEC xp_cmdshell @MD, no_output |
|
|
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2008-11-18 : 07:52:51
|
Thanks i would have never gotten that i did not know there had to be a space after the mkdir.Thanks for your help sakets_2000 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-11-18 : 08:23:46
|
quote: Originally posted by rookie_sql Thanks i would have never gotten that i did not know there had to be a space after the mkdir.Thanks for your help sakets_2000
Np :) |
|
|
|
|
|