Quantcast
Channel: Answers for "User defined function query"
Browsing latest articles
Browse All 8 View Live

Answer by Squirrel 1

what you want can't be done with function. You will have to use a stored procedure

View Article


Answer by Kristen

Why not just use Dynamic SQL if the Table Name is not known until runtime?Using dynamic SQL executed via sp_ExecuteSQL is very efficient - provided that the WHERE clause is parametrised as far as you...

View Article


Answer by Dinesh Kumar

In that case can i do this.DECLARE @P_TABLE VARCHAR(50) DECLARE @P_KEY VARCHAR(5) DECLARE @MSTR VARCHAR(100) SET @P_TABLE = 'EMPLOYEE' SET @P_KEY = '02814' SET @MSTR = 'SELECT * FROM '+ @P_TABLE+'...

View Article

Answer by Kristen

Yeah, I think that's good. It will be more efficient if you parametrise the WHERE clause: DECLARE @P_TABLE VARCHAR(50) DECLARE @P_KEY VARCHAR(5) DECLARE @MSTR VARCHAR(100) SET @P_TABLE = 'EMPLOYEE' SET...

View Article
Browsing latest articles
Browse All 8 View Live