View Single Post

   
  #4 (permalink)  
Old 02-28-2008, 08:26 PM
Erland Sommarskog
 
Posts: n/a
Default Re: exec(select...), how supress the output?

(foldface@yahoo.co.uk) writes:
>> > (2) Can I use the result of this query in another query somehow? e.g.
>> > select

>>
>> INSERT #tmp (...)
>> EXEC('...')

>
> sorry, don't understand this? Can you elaborate?


You can save the output from an EXEC() statement in a temp table, and
then use the temp table in the next query.

>> > (3) Can I control the size of the columns in the output somehow

>>
>> But if you are using Query Analyzer, and want some nice output there,
>> you can use convert(varchar(n), ...) where n is the size of your choice.

>
> create table #TempTable (id int)
> insert #TempTable Values (convert(varchar(50), 2))
> select * from #TempTable
>
> I know this is meant to convert values but what exactly should I be seeing
> here? I am talking about Query Analyser


I don't know exactly what you are trying to achieve, and you might be
better off if you explained more about your business requirements.

But the column width in QA depends on two things: the column name and the
data type. If you want control over the column width, all output columns
must be varchar. You cannot control the width of a float or an int column.


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Reply With Quote