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 |
mpolaiah
Starting Member
24 Posts |
Posted - 2009-08-05 : 14:26:49
|
Hi All,i am using the sqlcmd -d expot the data into text file at save the file 186.txtand once again run the sqlcmd -d and save the same path i loss the previous dataand save the new data.but i want prevous data also it is possible .....................likei am run the sqlcmd -d first time........................declare @SQLCmd varchar(500),@FilePath varchar(200),@nRequestid varchar(100)set @nRequestid=186--set @DBName='SMS'--set @TableName='AH_PRE_REQUEST_DETAILS'set @FilePath='F:\polo\'+@nRequestid+'.txt'--set @Separator='#'SET @SQLCmd ='sqlcmd -d SMS -Q "set nocount on;Select * From AH_PRE_REQUEST_DETAILS where nrequestid='+@nRequestid +'" -o "' + @FilePath + '" -W -s "' + '#' + '" -h -1'EXEC master..xp_cmdshell @SQLCmdi got the text file result is:10#186#919985339980#hiii#N#NULL#N#NULL#NULL11#186#919966402076#hiii#N#NULL#N#NULL#NULL12#186#919885900681#hiii#N#NULL#N#NULL#NULL13#186#919963791113#hiii#N#NULL#N#NULL#NULL14#186#919989912348#hiii#N#NULL#N#NULL#NULLonce again i run 15#187#919985339980#Suneel hi 9985339980#N#NULL#N#NULL#NULL16#187#919966402076#Naveen hi 9966402076#N#NULL#N#NULL#NULL17#187#919885900681#Chakri hi 9885900681#N#NULL#N#NULL#NULL18#187#919963791113#Pols hi 9963791113#N#NULL#N#NULL#NULLnow my file have only 15#187#919985339980#Suneel hi 9985339980#N#NULL#N#NULL#NULL16#187#919966402076#Naveen hi 9966402076#N#NULL#N#NULL#NULL17#187#919885900681#Chakri hi 9885900681#N#NULL#N#NULL#NULL18#187#919963791113#Pols hi 9963791113#N#NULL#N#NULL#NULLi loss the 10#186#919985339980#hiii#N#NULL#N#NULL#NULL11#186#919966402076#hiii#N#NULL#N#NULL#NULL12#186#919885900681#hiii#N#NULL#N#NULL#NULL13#186#919963791113#hiii#N#NULL#N#NULL#NULL14#186#919989912348#hiii#N#NULL#N#NULL#NULLthese data i want out put is.....................................10#186#919985339980#hiii#N#NULL#N#NULL#NULL11#186#919966402076#hiii#N#NULL#N#NULL#NULL12#186#919885900681#hiii#N#NULL#N#NULL#NULL13#186#919963791113#hiii#N#NULL#N#NULL#NULL14#186#919989912348#hiii#N#NULL#N#NULL#NULL15#187#919985339980#Suneel hi 9985339980#N#NULL#N#NULL#NULL16#187#919966402076#Naveen hi 9966402076#N#NULL#N#NULL#NULL17#187#919885900681#Chakri hi 9885900681#N#NULL#N#NULL#NULL18#187#919963791113#Pols hi 9963791113#N#NULL#N#NULL#NULLit is possible plz help meyouspols |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-08-05 : 15:03:17
|
Try to replace that -o with >> No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|