Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > SQL Server problem with Null values


Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2006, 06:21 AM
Meridian2000 Meridian2000 is offline
Contributor
 
Join Date: Jul 2003
Location: London/England
Posts: 565
Default SQL Server problem with Null values


Hi, I'm using SQL Server2000 and in one of my stored procedures I have used dynamic SQL
can someone please help me with updating a table that has null values in some of fields? I've used the following peice of dynamic sql in a stored procedure and this works fine

set @ssql = 'update [TI_Work] set ['+ @sEin +']' + ' = '''+ @sArea +''' where [date1] between ''' + @sDateFrom + ''' and ''' + @sDateTo + ''' '

exec (@ssql)

the problem I have is some of the fields have a null value in them, these I don't want to update, the SQL I've tried below doesn't work, can anyone help?

set @ssql = 'update [TI_Work] set ['+ @sEin +']' + ' = '''+ @sArea +''' where [date1] between ''' + @sDateFrom + ''' and ''' + @sDateTo + ''' and ['+ @sEin +']' + is not isnull'

exec (@ssql)
__________________
Bumshanka - May the seed of your loins be fruitful in the belly of your woman - The Young Ones
Reply With Quote
  #2  
Old 03-14-2006, 07:22 AM
GMan_NC's Avatar
GMan_NC GMan_NC is offline
Proud Daddy

Forum Leader
* Expert *
 
Join Date: Sep 2002
Location: North Carolina, USA
Posts: 1,962
Default

change 'is not isnull' to 'is not null'
__________________
A morning without coffee is like something without something else.
Reply With Quote
  #3  
Old 03-14-2006, 09:03 AM
Meridian2000 Meridian2000 is offline
Contributor
 
Join Date: Jul 2003
Location: London/England
Posts: 565
Default

Quote:
Originally Posted by GMan_NC
change 'is not isnull' to 'is not null'
great, thanks, I'll give that a try
__________________
Bumshanka - May the seed of your loins be fruitful in the belly of your woman - The Young Ones
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->