-- To export data with a header row
-- (Note datatype for all columns should be varchar b'cos of the header)
use pubs
go
select cast(min(case ordinal_position when 1 then column_name end) as
varchar) as col1,
cast(min(case ordinal_position when 2 then column_name end) as varchar)
as col2,
cast(min(case ordinal_position when 3 then column_name end) as varchar)
as col3,
cast(min(case ordinal_position when 4 then column_name end) as varchar)
as col4,
cast(min(case ordinal_position when 5 then column_name end) as varchar) as
col5,
cast(min(case ordinal_position when 6 then column_name end) as varchar)
as col6,
cast(min(case ordinal_position when 7 then column_name end) as varchar)
as col7,
cast(min(case ordinal_position when 8 then column_name end) as varchar)
as col8,
cast(min(case ordinal_position when 9 then column_name end) as varchar)
as col9
from information_schema.columns where table_name = 'authors'
union all
select au_id, au_lname, au_fname, phone, address, city, state, zip,
cast(contract as varchar)
from authors
--
Umachandar Jayachandran (UC)
SQL Server MVP, MCDBA, MCSE + Internet, MCP + Internet
Hi all,
When calling BCP with a command-line from DTS (Execute Process Task) in
SQL Server 7, there seems to be a limit of 255 characters that can be passed
on the command-line, including the 'BCP'.
Does anybody know why this limit is there?
Philip Livingstone
3. CLUSTER COMMAND LINE UTILITIES
4. Internet Self Study coarse on SQL
5. distribution agent utility command line: encrypted password parameter
6. Recover Database(7.0) on 2000
7. Missing SQL command-line utility: queueread
8. pgsql/src/backend/parser (scan.l)
9. OSQL (Command line utility) ????
10. Command line utility for SQL Scripts
13. Running a SQL file from OSQL command line utility