Click here to Skip to main content
15,881,248 members

Comments by AshishChaudha (Top 200 by date)

AshishChaudha 9-Dec-14 1:10am View    
Thanks..This I know very well..I want that value in @paidstatus variable when the table name is also dynamic..
AshishChaudha 9-Dec-14 1:08am View    
yes I declared variable
DECLARE @PAIDSTATUS VARCHAR(2)
BEGIN TRY
SET @SQL = 'SELECT ' + @PAIDSTATUS + ' = PAIDSTATUS FROM '+ @DATABASES +'.DBO.sometablename WHERE ROLLNO=''' + @ROLLNO +''''
SELECT @PAIDSTATUS
PRINT (@PAIDSTATUS)
EXEC (@SQL)

IF (@PAIDSTATUS!='Y')
SET @ERROR_MSG='You are not registered'
END TRY
BEGIN CATCH
RAISERROR(@ERROR_MSG,1,1)
END CATCH
AshishChaudha 24-Sep-13 7:18am View    
Reason for my vote of 5 \n good
AshishChaudha 10-May-13 1:01am View    
My +5 for good explanation..
AshishChaudha 3-May-13 5:40am View    
have you tried anything ?? please share your code here..