Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SET TARGET = NULL

Author  Topic 

sadbjp
INNER JOIN

41 Posts

Posted - 2007-05-02 : 11:29:22
Hi,

I am writing an insert stamenet that appears like:

INSERT INTO SppTarget (IndicatorNumber, Part, Years, Target, CompareMethod)
SELECT '8', 'B', '20052006', '0.682', '1' UNION ALL
SELECT '8', 'B', '20062007', '0.688', '1' UNION ALL
SELECT '8', 'B', '20072008', '0.692', '1'

What if I want to SET Target = NULL in this statement, how can i do that?

Thanks in advance !

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-02 : 11:31:22
[code]
INSERT INTO SppTarget (IndicatorNumber, Part, Years, Target, CompareMethod)
SELECT '8', 'B', '20052006', NULL, '1' UNION ALL
SELECT '8', 'B', '20062007', NULL, '1' UNION ALL
SELECT '8', 'B', '20072008', NULL, '1'
[/code]


KH

Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-05-02 : 11:32:50
Either you can do while inserting ..

INSERT INTO SppTarget
(IndicatorNumber, Part, Years, Target, CompareMethod)
SELECT '8', 'B', '20052006', NULL, '1' UNION ALL
SELECT '8', 'B', '20062007', NULL, '1' UNION ALL
SELECT '8', 'B', '20072008', NULL, '1'


or you can write a update for it


Update SppTarget Set Target = Null


Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

sadbjp
INNER JOIN

41 Posts

Posted - 2007-05-02 : 11:34:41
Thanks Chirag and KH. Appreciate your help.
Go to Top of Page
   

- Advertisement -