Just put the table name in the @TableName variable.
You can also apply filtering in the where clause to only get certian fields.
pawonwatcsv,
2016-08-30 (first published: 2015-03-23)
Just put the table name in the @TableName variable.
You can also apply filtering in the where clause to only get certian fields.
DECLARE @TableName SYSNAME = 'tablename' SELECT REPLACE(REVERSE(STUFF(REVERSE((SELECT name + ',' AS [data()] FROM sys.columns WHERE OBJECT_NAME(object_id) = @TableName ORDER BY column_id FOR XML PATH(''))),1,1,'')),' ','')
JSON is a viable option for transferring data between systems. It has the ability to include schema information along with the data which is an advantage over CSV files. In this article, Phil Factor demonstrates how he takes advantage of JSON when exporting or importing tables.
2018-12-05
3,025 reads
In this article, we will see of a quick way to load CSV files from a directory on your computer.
2018-09-18
6,383 reads
Phil Factor is not amused by SQL Server's handling of the comma-separated value (CSV) file format.
2018-08-27
330 reads
In this example we will join two CSV files with a common column using SQL Server.
2017-01-23
5,680 reads
Despite the neglect of the basic ODBC drivers over the years, they still afford a neat way of reading from, and writing to, CSV files; and to be able to do so in SQL as if they were tables is somewhat magical. Just to prove it is possible, Phil Factor creates a CSV version of AdventureWorks as a linked server.
2012-05-11
5,604 reads