Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 with SQL Server Analysis Services 2005 | Excel Discussion (Misc queries) | |||
Import data from Excel to SQL Server 2005 | Excel Discussion (Misc queries) | |||
How to connect the Excel 2007 in SQL Server 2005? | Excel Worksheet Functions | |||
Cannot create instance of C# COM server compile with VS 2005 | Excel Programming | |||
SQL Server (2005 or other) - Permissions on Views Excel Connection | Excel Programming |