View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 07:25 PM
foldface@yahoo.co.uk
 
Posts: n/a
Default Re: exec(select...), how supress the output?

> > (1) Can I suppress the output somehow if this returns no values?
>
> EXEC ('IF EXISTS (SELECT * FROM ' + @tablename ' + ') SELECT * FROM ' +
> @tablename)


worked this out in the end but as I'm using google for news access from
work I couldn't reply to my own mail. Thanks anyway

> > (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?


> > (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
Reply With Quote