Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dashes in temp table 3

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
US
When I create a table like this
CREATE TABLE #Temp
(
temp1 text
) and then select from it
like this

select convert(varchar(1900),temp1) from #Temp

I get dashes as the first line
-----------------------------------------

I do not insert them into the table. Where do they come from and how to get rid of them? I am using the table to create XML file out of a query and I do not need these dashes

thanks for any help!!!
 
This is not actually a row from your table. You are probably runnning the query in text mode. Try grid mode, CTRL-D and run it again. If you don't give this:

convert(varchar(1900),temp1)

an alias name, it will only print out a line of dashes, but if you give it a name it will print a column heading:

convert(varchar(1900),temp1) as field, will output:

field
---------------------------------------

Tim
 
But I do need it in a text file. Even when I chnage the query to output results into a file I get the dashes. Any ideas?

thanks
 
You will always get the dashes, that basically separates your field headings from your rows of data you are returning. Are you taking the results and copying and pasting them into a text file? You'll have to remove the dashes manually then. What does your query look like?

Tim
 
It has this structure

CREATE TABLE #Temp
(
temp1 text
)

set nocount on
insert into #Temp
Select
'<tag>' + Table.SomeField + '</tag>'+
'<tag2>' + Table.SomeField2 + '</tag>'

From Table
Where...

select convert(varchar(1900),temp1) from #Temp


Also this is a store procedure. I do not copy and paste anything, I use Send Results to File option in SQL Query Analyzer and that creates .rpt file.

thanks
 
I see. You'll have to remove these manually I'm afraid. I don't see any options to exclude the dashed lines or headings.

Tim
 
Replace what? The dashes? This is a SQL server system setup. It is part of the design of the returned result set. It isn't something as far as I know, that you modify. If you really need to see the results without the dashes, then you may want to look at exporting the results through a DTS or a bcp command. As far as I know, there is no way to get rid of the dashes the way your are currently going about it.

Tim
 
In Query Analyzer go to Tools, Options, Results tab and unselect "Print column headers". That will get rid of the header and dashes.

--James
 
Hi

If you turn off print column headers within Query Analyzer\Tool\options & Results it will remove the ----------- line
also you can play with the results output format, I note if column aligned you will get your lines, if you choose something else if pssoble
like tab deliminated you will also remove the lines

hope this helps
 
Learned something new. I figured one of the gurus would know a way. Only problem is that you won't have column names either.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top