I have created a temp table in sql server and inserted values to it. If the values of a particular column are null i need to fill using some values from another table. How to query this?
sample data given below.
select 'name' as name,3 as age,'email' as email into #tmp1 from table1
Now if the column age is empty i need to insert a value to the column age to all the existing records in tmp1.
INSERT INTO #tmp1 (age)SELECT age AS [age] FROM table2 WHERE name=@name
But it inserts a new record.
please help.
Aucun commentaire:
Enregistrer un commentaire