Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default passing Nulls to SQL Server 2005

I have some stored procedures in a SQL Server 2005 database to which I pass
Excel data by way of VBA. These sprocs have parameters, some of which are
expecting strings from cells in text-type columns in Excel - these are then
passed to database fields of type varchar or nvarchar. This code currently
falls over if one of these cells has nothing in it. Does anyone know of a
way in Excel/VBA that I can pass nulls successfully to text fields in SQL
Server? Perhaps some VBA constant I haven't heard of.

(I know I can deal with it in the stored procedures by setting defaults of
null and then using If conditions but this seems unnecessarily
overcomplicated.)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default passing Nulls to SQL Server 2005

Maybe try passing a nullstring (""), or maybe use the Null keyword.

--
Hope that helps.

Vergel Adriano


"Smallweed" wrote:

I have some stored procedures in a SQL Server 2005 database to which I pass
Excel data by way of VBA. These sprocs have parameters, some of which are
expecting strings from cells in text-type columns in Excel - these are then
passed to database fields of type varchar or nvarchar. This code currently
falls over if one of these cells has nothing in it. Does anyone know of a
way in Excel/VBA that I can pass nulls successfully to text fields in SQL
Server? Perhaps some VBA constant I haven't heard of.

(I know I can deal with it in the stored procedures by setting defaults of
null and then using If conditions but this seems unnecessarily
overcomplicated.)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default passing Nulls to SQL Server 2005

Thanks Vergel but those don't seem to work. I'm currently working around it
by passing a space " " for empty cells but it seems a bit clumsy!

"Vergel Adriano" wrote:

Maybe try passing a nullstring (""), or maybe use the Null keyword.

--
Hope that helps.

Vergel Adriano


"Smallweed" wrote:

I have some stored procedures in a SQL Server 2005 database to which I pass
Excel data by way of VBA. These sprocs have parameters, some of which are
expecting strings from cells in text-type columns in Excel - these are then
passed to database fields of type varchar or nvarchar. This code currently
falls over if one of these cells has nothing in it. Does anyone know of a
way in Excel/VBA that I can pass nulls successfully to text fields in SQL
Server? Perhaps some VBA constant I haven't heard of.

(I know I can deal with it in the stored procedures by setting defaults of
null and then using If conditions but this seems unnecessarily
overcomplicated.)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 with SQL Server Analysis Services 2005 Salles Excel Discussion (Misc queries) 0 August 22nd 09 06:54 PM
Import data from Excel to SQL Server 2005 [email protected] Excel Discussion (Misc queries) 0 January 22nd 09 11:29 PM
How to connect the Excel 2007 in SQL Server 2005? davidshen Excel Worksheet Functions 0 March 24th 08 02:11 AM
Cannot create instance of C# COM server compile with VS 2005 Ray Lau[_2_] Excel Programming 0 June 22nd 06 09:07 AM
SQL Server (2005 or other) - Permissions on Views Excel Connection [email protected] Excel Programming 1 May 29th 06 05:39 PM


All times are GMT +1. The time now is 02:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"