Monday, June 2, 2014

SQL SERVER Convert DateTime to String and Print Result to output window

DECLARE @REQUEST_DATE NVARCHAR(50)
SELECT @REQUEST_DATE =CONVERT(NVARCHAR(50) , R.CREATE_DATE ,120)

----------------
print result to output window messages

PRINT N'@REQ_ID = ' + RTRIM(CAST(@REQ_ID AS NVARCHAR(3000))) + N'.';
PRINT N'@REQUEST_DATE = ' + RTRIM(CAST(@REQUEST_DATE AS NVARCHAR(50))) + N'.';
PRINT N'@WORK_FLOW_NAME = ' + RTRIM(CAST(@WORK_FLOW_NAME AS NVARCHAR(3000))) + N'.';


-------------------------------------------
CONVERT INT TO NVARCHAR

SELECT @REQUEST_DETAILS =N'الجهة الطالبة : ' + R.INCOME_SIDE_NAME +N'<BR>'
+N'عدد أيام الاجازة' +  RTRIM(CAST(R.VACATION_NO_OF_DAYS AS NVARCHAR(50)))  + N'<BR>'
+N'من تاريخ' + CONVERT(NVARCHAR(50) , R.VACATION_FROM_DATE ,120)   + N'<BR>'
FROM VACATION_REPORTS_REQUEST R
WHERE R.REQUEST_REPORT_NO =@REQUEST_ID





No comments:

Post a Comment