devxlogo

Dynamically Building the BCP Command Line Text Using the Query Analyzer

Dynamically Building the BCP Command Line Text Using the Query Analyzer

This is the easiest way:

 Select "bcp " + db_name() + ".." + name +" out c:	emp" + name + ".txt /c -t	 -SserverName_ -Usa -Ppassword/b1000"from sysobjectswhere type = "U"order by nameoutput will be like this we can use this as command _line arguement forgetting bcp out.bcp pubs..authors out c:	empauthors.txt/c -t	 -SserverName -Usa -Ppassword /b1000bcp pubs..discounts out c:	empdiscounts.txt/c -t	 -SserverName -Usa -Ppassword /b1000

devx-admin

Share the Post: