Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mmkrishna1919
Yak Posting Veteran
95 Posts |
Posted - 2013-02-26 : 02:26:45
|
Hi All,when i execute a query in ms sql server the result set is showing in the below formatSample query:select 10 as testOutput:test ---------------------------------------------------------------------10Actually i am saving the result set directly into the file,But the problem here is my result set is fixed length it has lecgth of 60 characters data is coming exactly 6o characters length,but the lines(----------- ) are coming with length of 5000. So i am getting more than one row in the output file i need to avoid that i have to show only one line.is there any option to set the line size..Expected formattest ----------- (Need to reduce the size of line)10Thanks..M.MURALI kRISHNA |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-26 : 02:30:34
|
select cast(10 as varchar(60)) as test------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
mmkrishna1919
Yak Posting Veteran
95 Posts |
Posted - 2013-02-26 : 02:41:40
|
Thanks visakh,in case of simple select i got it..but my final select is as shown belowselect cast(col1 as char(8))+cast(col2 as char(12))+cast(col3 as char(36))+'TEST'from table_namei am concatenating few columns and static data to make length of 60 characters.In this case how can i use cast to control the number of lines in the result setThanks...M.MURALI kRISHNA |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-26 : 02:52:24
|
same as beforeselect cast(cast(col1 as char(8))+cast(col2 as char(12))+cast(col3 as char(36))+'TEST' as char(60)) AS yourcolumnnamefrom table_name ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|