Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BCP problem
Message
From
23/05/2011 10:29:44
 
 
To
23/05/2011 10:09:05
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
01511476
Message ID:
01511477
Views:
40
I needed an extra quote.
  set @sql='bcp "SELECT * FROM integra_test.dbo.new_member_list where GrName = '''+@AreaGroupRef+'''" queryout "'+@filename+'" -c -q -t , -T'
>Hi
>
>I have a problem with a BCP command
>
>I'm using to to export data to a csv file.
>
>When it runs 0 rows are copied.
>
>
>If I run the select command that the bcp package is using it does select data so I think that parameter is being passed correctly..
>
>Any ideas why that selected data is not being copied to the output file.
>
>below is the code.
>
>Thanks
>
>
>OPEN group_list
>
>FETCH NEXT FROM group_list into @AreaGroupRef
>WHILE (@@FETCH_STATUS <> -1)
>BEGIN
>
>set @filename = 'c:\AG_Export\'+@AreaGroupRef+'.csv'
>
>  set @sql='bcp "SELECT * FROM integra_test.dbo.new_member_list where GrName = ''+@AreaGroupRef+''" queryout "'+@filename+'" -c -q -t , -T'
>
>   	EXEC master..xp_cmdshell  @sql
>	FETCH NEXT FROM group_list into @AreaGroupRef
>
>END
>
Previous
Reply
Map
View

Click here to load this message in the networking platform