Reputation: 1070
I'm trying to make an expression in SQL Server, that will check if certain column is null, and if it is null, set a new GUID number..
This is my code :
select
isnull((select Guid
from therapists
where username = 'ido' and password = 'ido'),
(update therapists
set guid = NEWID()
where username = 'ido' and password = 'ido'))
Upvotes: 0
Views: 41
Reputation: 5269
You can try this:
UPDATE therapists SET guid = NEWID()
WHERE username = 'ido'
AND password = 'ido'
AND guid IS NULL;
Upvotes: 1