Feb 28, 2007 #1 jrprogr Programmer Jul 20, 2006 74 US I want to export the data to a file with space separated. Ex: Location Length -------- ------ Col1value 1 10 Column2 12 2 Col3value 18 3 Please help me.I did tried by enabling in the tools- options-results tab.
I want to export the data to a file with space separated. Ex: Location Length -------- ------ Col1value 1 10 Column2 12 2 Col3value 18 3 Please help me.I did tried by enabling in the tools- options-results tab.
Feb 28, 2007 #2 gmmastros Programmer Feb 15, 2005 14,901 US Make your query look like this... [tt][blue] Select Left(Col1Value + Replicate(' ', 10), 10) + Left(Column2 + Replicate(' ', 2), 2) + Left(Col3Value + Replicate(' ', 3), 3) From TableName [/tt][/blue] If any of the columns have a data type other than varchar, then you should first convert the value to varchar in the query. Then, in query analyzer, Query -> Results To File just before you run it. When you run the query, you will be prompted with a file name. -George Strong and bitter words indicate a weak cause. - Fortune cookie wisdom Upvote 0 Downvote
Make your query look like this... [tt][blue] Select Left(Col1Value + Replicate(' ', 10), 10) + Left(Column2 + Replicate(' ', 2), 2) + Left(Col3Value + Replicate(' ', 3), 3) From TableName [/tt][/blue] If any of the columns have a data type other than varchar, then you should first convert the value to varchar in the query. Then, in query analyzer, Query -> Results To File just before you run it. When you run the query, you will be prompted with a file name. -George Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
Mar 1, 2007 #3 mrdenny Programmer May 27, 2002 11,595 Use BCP. It's made for exporting data. Denny MCSA (2003) / MCDBA (SQL 2000) MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration) MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005) --Anything is possible. All it takes is a little research. (Me) http://www.mrdenny.com Upvote 0 Downvote
Use BCP. It's made for exporting data. Denny MCSA (2003) / MCDBA (SQL 2000) MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration) MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005) --Anything is possible. All it takes is a little research. (Me) http://www.mrdenny.com