XtremeRain was founded by Hasibul Kabir back in 2014. It publishes tips, tricks, solutions, reviews, blogs on technology and lifestyle. The founder, Hasibul Kabir is a Web Entrepreneur and Blogger studying Hons on Computer Science and Engineering.
I've been attempting to work on getting the result of a large and multiply-joined SELECT declaration, and e-mail the issue outcome as a CVS document.I have got the predicament correct and the contacting straight down, but I'meters having problems automating the export of the outcome as a CVS file. From what I've ended up reading through, the greatest wager for auto-exporting issue results is a tool known as 'BCP'.
I attempted to make use of BCP like this in Administration Studio room:
Impact is certainly the name of a specific data source, and datexfootprint a schema.(This is not really the real query, just a test one particular).
When I run this, the error I obtain is:'SQLState=S0002, NativeError = 208'Mistake = MicrosoftSQL Server Native Client 10.0SQL Server Invalid item title 'datexfootprint.Deliveries'.'
I feel 100% good that datexfootprint.Deliveries is certainly the right schematable entry for the information I'm attempting to check on.
Will anyone notice what I'michael lacking or performing incorrect in attempting to export this outcome to a CSV document? Specifically, though, I'michael trying to automate this procedure. I understand how to export results into a CSV document, but I wish to perform it in T-SQL so I can automate the era of the document by time of day.
Any help would be appreciated!
Mister L2
Mister Ur2Mister R2
3715 silver badges7 sterling silver badges20 bronze badges
2 Answers
Fixed
I figured out what I had been doing wrong. I had been not determining the look at in complete form. I had been using 'schema.Desk/View', rather of 'database.schema.table/view'.Also, I included a '-T' + @@SERVERNAME flag - this informs the BCP power to use the machine SQL Server is currently connected to for the question.
The appropriate code to produce a CSV file of a SELECT-query's outcomes in T-SQL, SQL Server 2008 can be:
Therefore once I added 'FootPrint.' to recognize the data source, it worked.
Take note: I'michael running SQL Server 2008 L2.
Mister R2Mister L23715 gold badges7 magic badges20 bronze badges
I have got got exact same error but I possess solved it in a different way.I have got added the default database to my Identification then BCP started looking the dining tables in my default data source and prepared the documents.
Kumar KannaveniKumar Kannaveni