tsql - Dynamic SQL with variables inside a view (SQL Server) -


hello i'm trying inside new view window in sql server 2008:

declare @var = (select db databases); exec ('select name ' + @var ' + .dbo.names);

this view runs in sql server cannot save (it gives me error), potentially create table returning function, of same stuff in , return table , create view takes table unsure of performance hits occur doing this. suggestions appreciated! thanks.

solution: ended having drop old view , recreate new view (using dynamic sql) in stored procedure. when value changed call sp update views point correct databases. guys, knowing can't done stopped me trying methods.

view's cannot accept parameters. table valued function solution. have @ least know table , result set going come out other end. if passing table queried parameter how know structure of resulting data set?


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -