I'm obviously novice at SQL. I am creating a stored procedure and I am creating a tempory table and using this statement as one of the insert values.
(case when Checks.ditronicsSettledate = NULL then CONVERT(VARCHAR(11),'NA')
else (SELECT CONVERT(VARCHAR(11),Checks.ditronicsSettleDate, 101) AS [MM/DD/YYYY])
what I am trying to do is if a Checks.dtironicsSettledate is NULL I want to store the value NA , else I want to store the date in the character field.
Chekcs.ditronicsSettledate is a datetime field. and the field I am using this statement to insert into is a varchar(11) field.
The sp compiles fine but when I run it , NULL is not replaced by NA. I tried the statement with out the CONVERT(varchar(11),NA) as just Checks.ditronicsSettledate = NULL than 'NA' but I recieved errors regarding not being able to convert and int to a varchar.