sql server - Passing parameters to BCP command in SSIS execute SQL task -


first of all, can pass parameters path in bcp command?

i wrote query in exec sql task

exec xp_cmdshell 'bcp "select * tlc.dbo.world_hosts" queryout `"c:\users\akshay.kapila\desktop\tlc\foreachlearn\dest\?.txt" -t -c -t '` 

i have given ? in path. want specific countries in place of that. held in variable "country".i using foreach loop creates rather should create file ex aus.txt,in.txt everytime loop runs specific value.

can use way. if not, how can pass variable value path in bcp command?

you can use variable sqlsourcetype in execute sql task.

create variable hold bcp command, may like:

"exec xp_cmdshell 'bcp \"select ''abc'' output\" queryout \"" + @[user::strfilename] + "\" -t -c -t '" 

here @[user::strfilename] dynamic file want generate.

then in execute sql task, change sqlsourcetype variable, , select variable generated.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -