Quantcast
Channel: Answers for "User defined function query"
Viewing all articles
Browse latest Browse all 8

Answer by Dinesh Kumar

$
0
0

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+' WHERE EMP_NO='''+@P_KEY+''''            
exec sp_executesql N'SELECT * FROM '+ @P_TABLE+ ' WHERE EMP_NO='''+@P_KEY+''''            

Viewing all articles
Browse latest Browse all 8

Trending Articles