I’m not good at t-sql, so I need help.
I have this code I wrote myself, but how write that I want I don’t know (and sorry for English)
declare @questionid int
set @questionid = 22
declare @providerid int
set @providerid = 189
select [closed] into #question from [Data].[dbo].[Question] where [questionid] = @questionid
-- and here, if [closed] is null I must write in the question table current date GETDATE()
UPDATE [Data].[dbo].[Question] SET [closed] = GETDATE() WHERE [questionid] = @questionid and [providerid] = @providerid
-- or, if [closed] is not null I must write there null
UPDATE [Data].[dbo].[Question] SET [closed] = null WHERE [questionid] = @questionid and [providerid] = @providerid
drop table #question
How can I do that?
You don’t need the temp table for this
I must say, I don’t understand the logic you are trying to achieve…