I found the solution....
We can use the following SQL Command for this...
EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT object_name(object_id) As TbLName,name as ColName FROM SandBox.sys.columns ORDER BY object_name(object_id), column_id" queryout C:\Data\Objects.txt -t"|" -c -T '
or else we will do the following Management Studio Settings...
If your using Microsoft Sql Server management studio this is Configurable.
(actually almost the exact same in query analyzer)
Tool--> Options -->Query Results --> Sql Server --> Results to Text.
Change output format from
Tab Delimited to Custom Delimited.
Put a Pipe in the Custom Delimiter Box.
Go back to your query
select Query --> Results to File. Execute file, Give it a Disk path and a name.
The
file will be your name with a .rpt Extension, you can rename it to have a .txt extension.
You obviously have to set the results to text value back to your previous setting if you don't want this permanently.
Works good for a one time once in a while thing. but if you must generate this file frequently I would look at creating a SSIS Package. or as suggested above.
Regards,
GVPrabu