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.
Author |
Topic |
eirikr_1
Starting Member
27 Posts |
Posted - 2013-02-11 : 14:39:00
|
what is wrong with this sql? It does not allow me to insert a test computer, when test is not in databaseif not exists (select distinct NetBIOSName from Computers)begininsert into Computers(NetBIOSName, IP)values('test','111.22.33.444')end |
|
eirikr_1
Starting Member
27 Posts |
Posted - 2013-02-11 : 14:48:08
|
I got it. I missed a condition in select distinct NetBIOSName from Computers where NetBIOSName='test' |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2013-02-11 : 14:48:18
|
Unless your table is empty, select distinct NetBIOSName from Computers will always return at least one record.[Edit] NM you found it. How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
|
|
|
|
|