Handling Null Dates

Feb 8, 2008

Hi,
 I have a database field for completion dates - until a task is completed, there is no date and at the moment I have null values in this field.
My problem arises when searching the records.  I have a search form which passes parameters via a query string to a SqlDataSource.  The SqlDataSource has the CancelSelectOnNullParameter set to true, so if any fields on the search form are left blank, they are ignored.  For other dates, my sql query contains something like  (Job.EnteredAt < ISNULL(DATEADD(d, 1, @EntTo), '2099-01-01')) 
This approach doesn't return any records for the completion date as there is no date to compare to the '2099-01-01'.
Can anyone give me any tips on how I should handle this?  I'm willing to change my structure, search page or sql query!

Thanks,
 Neil
 

View 1 Replies


ADVERTISEMENT

Problem With Handling Dates

Nov 1, 2005

hi allI have a stored procedure that gets date from a particular field using the DATEPART function. However, somewhere in between it has to do an update which is why it adds hours, days or months to the function. Here is the codeSELECT @var_NewNextRunDate=(CAST(DATEPART(YYYY,@DT) AS CHAR(4)) + '/'        + RIGHT(CAST(100+DATEPART(MM,@DT) AS CHAR(3)),2) + '/'       + RIGHT(CAST(100+DATEPART(DD,@DT) AS CHAR(3)),2) + ' '       + RIGHT(CAST(100+DATEPART(HH,@DT) + @var_Frequency AS CHAR(3)),2) + ':'       + RIGHT(CAST(DATEPART(MI,@DT) AS CHAR(2)),2) + ':'     + RIGHT(CAST(DATEPART(SS,@DT) AS CHAR(2)),2)+ ':'  + RIGHT(CAST(DATEPART(MS,@DT) AS CHAR(3)),3)   )Now the problem is that when there a change in day the hours get stuck because it simply adds the hours so if it is 23:40 and it adds 3 it becomes 26:40 which makes no sense. Can someone please help me find a solution to this? I have the same situation with days, and months as well. Thank you.

View 2 Replies View Related

Diffrence In Handling Dates Between MSDE 2000 And SQL Express

Apr 27, 2007

I have a query that worked fine on MSDE 2000. The query evaluates a date using which is written between ''. Ex '1-1-1970'



Now I detached and attached the database to a SQL Express instance and ran the query but it fails with the error:



The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.



When I remove '' around the dates in the query, all works fine. Is this because of a diffrence between MSDE 2000 and SQL Express?



By the way. I am using the sql.net library which 'creates the query for me'.

View 3 Replies View Related

Handling NULL Values.

Oct 19, 2007

Hi,

I would like to know the solution for the below problem.

Actually I have a single Hibernate xml file which has the query on it. And I am accessing the xml file for SQL server 2005 and Oracle 10G. But the query is working in Oracle and not working in SQl Server.

I noticed from the query that handling 'NULL' is the problem.

Findings:
1. The following query is the same in both Oracle and SQL Server, which is causing the Issue.
SELECT *
FROM CLIENT_SKU AS o
WHERE o.OU_ID = 20000000
AND ((o.CLIENT_SKU_START_CODE <= 'wwwww' AND o.CLIENT_SKU_END_CODE >= 'wwwww')
OR (o.CLIENT_SKU_START_CODE <= '' AND o.CLIENT_SKU_END_CODE >= '')
OR (o.CLIENT_SKU_START_CODE >= 'wwwww' AND o.CLIENT_SKU_END_CODE < '')
OR (o.CLIENT_SKU_START_CODE = 'wwwww' AND o.CLIENT_SKU_END_CODE is null))

CAUSE:
Oracle treats NULL and the empty string almost the same making the latter almost an alias for NULL
The following two statements produce identical results:
1. update employee set lastname = ''
2. update employee set lastname = NULL
In our case, the CLIENT_SKU_END_CODE is an empty string which is being checked with an empty string returns False in Oracle where as returns True in Sql Server causing the issue.

It would be great if any one who can give some possible solution to resolve the same.

Thnx

View 3 Replies View Related

Handling A Null Datetime Column

Nov 12, 2007

can anybody tell me how to do a select query on a datetime field where if i have a null value in that column, i need to display a some character.

View 4 Replies View Related

Handling A NULL Datetime In DATEDIFF()

Jan 28, 2008

 I want to select records where AnswerDate is within 30 days of today, and include records that have a NULL AnswerDate.
How can I tell DATEDIFF to treat NULL as Today?  (I think I am looking for something like VBA's nz() function.) 
 
SELECT RegistrationID ,  
AnswerDate, 
(DATEDIFF(dd,AnswerDate,GETUTCDATE())) AS InvitationAge
FROM Registration
WHERE (DATEDIFF(dd,AnswerDate,GETUTCDATE())) <= 30
 
Thanks

View 3 Replies View Related

Handling Null Date Values

Jun 30, 2000

I would like some suggestions on how to keep from displaying the value "1/1/1900" on my asp pages when my recordset field returns a Sql date value that is null

Thanks for any tips
Jim

View 1 Replies View Related

Null Value Handling In SSIS Package

May 24, 2007



Hi All



I am facing this problem while loading data from text file into Table.

Scenario is -



There are chances of having spaces for null values in text file.



when i m trying to rum my SSIS package this is getting failed.



How can i avoid this problem? i want null values to be inserted if ther is spaces for that field in text file.



Thanks,

Anshu

View 1 Replies View Related

Handling Null Fields With Three-tier Architecture

Nov 28, 2006

I using Visual Web Designer Express (with Visual Basic), with a SQL Server 2000 database.   I have a prototype application running satisfactorily using code that builds queries, but I'm now trying to rebuild the application "properly" using three-tier architecture.  I have been following the principles of Scott Mitchell's tutorials.  I have created an database .xsd with a table adaptor, and replaced the rather grotty query-building code in the business layer with better code referencing the table adaptor.   Thus where the first version had code: -
        Dim queryString As String = "SELECT * FROM NZGDB_User WHERE USRid = '" & Userid & "'"        Dim message As String = ""        Dim Found As Boolean = False        Try            Using connection As New SqlConnection(GDB_AppSettings.Connection)                Dim command As New SqlCommand(queryString, connection)                connection.Open()
                Dim reader As SqlDataReader = command.ExecuteReader()
                If reader.Read() Then                    Found = True                    _USRid = reader("USRid")                    _USRPassword = reader("USRPassword")                    _USREmail = reader("USREmail")                    _USRTitle = reader("USRTitle")                    _USRName = reader("USRName")                    _USRRole = reader("USRRole")                    If IsDBNull(reader("USRAgreedConditions")) = False Then                        _USRAgreedConditions = reader("USRAgreedConditions")                    End If                End If                reader.Close()            End Using        Catch ex As Exception            If Left(Err.Description, 68) = "An error has occurred while establishing a connection to the server." Then                Return "Cannot open database to logon"            Else                Return Err.Description            End If        End Try
the new version is much more elegant: -
        Dim taUser As New NZGDBTableAdapters.NZGDB_UserTableAdapter()
        Dim tbUser As NZGDB.NZGDB_UserDataTable = taUser.GetUserByUserid(userid)        If tbUser.Count <> 1 Then   '   Anything other than 0 or 1 should be impossible            Return "User not found"        End If
        Dim trUser As NZGDB.NZGDB_UserRow = tbUser(0)        _USRid = userid        _USRPassword = password        _USREmail = trUser.USREmail        _USRTitle = trUser.USRTitle        _USRName = trUser.USRName        _USRRole = trUser.USRRole        _USRAgreedConditions = trUser.USRAgreedConditions
However, there is a problem.  The database field USRAgreedConditions is a Datetime field that can be null.  The new version works perfectly when it is NOT null, but throws an exception: -
System.Data.StrongTypingException was unhandled by user code  Message="The value for column 'USRAgreedConditions' in table 'NZGDB_User' is DBNull."  Source="App_Code.wt2vzoc1"  ....
There is no point in writing: -        If Not IsDBNull(trUser.USRAgreedConditions) Then            _USRAgreedConditions = trUser.USRAgreedConditions        End Ifbecause the exception occurs within the automatically-created code in the data access layer.  I tried changing the Nullvalue property of the field USRAgreedConditions in the table adaptor, but the only valid option is (Throw Exception) unless the field is a String.  Of course USRAgreedConditions is a Datetime field, so I can't change the property.
It seems that my only options are: -1.   To stick with the old query-building code.   But this doesn't give me the advantages of a proper 3-tier architecture2.   To change the generated code in wt2vzoc.  This MUST be a bad idea - surely I should leave this code untouched.  Besides, what if the table adaptor has to be regenerated when I change the table design?3.   Code a Try block within the business layer: -    Try         _USRAgreedConditions = trUser.USRAgreedConditions    Catch ex As Exception         _USRAgreedConditions = Nothing    End Try
This seems to work OK, but seems less elegant than the original code in the old version: -       If IsDBNull(reader("USRAgreedConditions")) = False Then            _USRAgreedConditions = reader("USRAgreedConditions")       End IfIs there a better way?

View 4 Replies View Related

DB Null, Dates And Datatables

Jan 12, 2007

VS05
How are dates removed / nullified? 
I have a SQL datetime field that is being editted via a datatable / adapter - The table structure defines the datetime as a date.
From here I want to remove the date - i.e. write DBNull back to the database.  Setting the Date to Nothing or .minvalue results in a min date exception and DBNull cannot be cast to the datetime either.
R

View 3 Replies View Related

Allowing Null Dates

Aug 4, 2007

My users want to be able to enter nothing in a date field.

I'm using asp.net v2, vb.net, and VS 2005 for my application. I'm not sure what to do or what code to write to allow the user not to enter a date and keep from hitting the sqldatetime overflow error.

I could use some help.

Thanks

View 4 Replies View Related

Dealing With Dates And Null Values

Apr 2, 2007

Hi EveryoneVery new to .net and currently dipping my toes in the water with a small application, but getting to the point -
I have a form which has somel text fields that expect a date but which are not a required field so in other words the user can leave them blank.
The code behind page stores the information using a stored procedure which I add parameters to in the following fashion -
SqlParameter userdate = new SqlParameter();userdate .ParameterName = "@dtdate";userdate .SqlDbType = SqlDbType.DateTime;userdate .Direction = ParameterDirection.Input;userdate .Value = dtdate.Text.ToString();cmd.Parameters.Add(userdate);
Now if I leave the text field dtdate blank I receive an error because the above expects a date.
If I remove the line userdate .SqlDbType = SqlDbType.DateTime; I don't recieve an error but my stored procedure saves the date as 01/01/1900 or similar.
I believe this is because in my stored procedure the paramger dtdate is defined as @dtdate datetime
Obviously I want to have it so that if the user leaves the text field empty then no date is saved in the database and was wondering how other people tackle this scenario.

View 3 Replies View Related

How To Handle NULL Dates In Formulas?

Mar 19, 2008

Re: SQL Server Reporting Services

I have welders who have active dates and inactive dates, and I need to create an "isactive" column in the report. My formula will be pretty obvious to most of you. However, if the user does not input an inactive date, that means none has been given and therefore the welder is currently active. The problem is that there seems to be no way to check if inactive date is null or not in the formula.

Please help! Thanks!

View 11 Replies View Related

Injecting Null Rows For Dates Not Found

Jan 16, 2007

I have been looking for the answer to this for a while, but probably haven't found the right place or query. I want to achieve the following:Table 1Table 2
DateShiftDateShiftData
---------------------------------------------------------------------------------
1/1/200711/1/20072Some data
1/1/200721/2/20073Some more data
1/1/20073
1/2/20071
1/1/20072
1/1/20073

and generate:
Table 3
DateShiftData
--------------------------------------------------------
1/1/20071NULL
1/1/20072Some data
1/1/20073NULL
1/2/20071NULL
1/1/20072NULL
1/1/20073Some more data

This way, the information can be displayed and show that some of the entries were not entered for the dates with NULL. Thanks for the help, -Syn

View 2 Replies View Related

Problem With Isnull. Need To Substitute Null If A Var Is Null And Compare It To Null And Return True

Sep 20, 2006

Hey. I need to substitute a value from a table if the input var is null. This is fine if the value coming from table is not null. But, it the table value is also null, it doesn't work. The problem I'm getting is in the isnull line which is in Dark green color because @inFileVersion is set to null explicitly and when the isnull function evaluates, value returned from DR.FileVersion is also null which is correct. I want the null=null to return true which is why i set ansi_nulls off. But it doesn't return anything. And the select statement should return something but in my case it returns null. If I comment the isnull statements in the where clause, everything works fine. Please tell me what am I doing wrong. Is it possible to do this without setting the ansi_nulls to off??? Thank you

set ansi_nulls off


go

declare

@inFileName VARCHAR (100),

@inFileSize INT,

@Id int,

@inlanguageid INT,

@inFileVersion VARCHAR (100),

@ExeState int

set @inFileName = 'A0006337.EXE'

set @inFileSize = 28796

set @Id= 1

set @inlanguageid =null

set @inFileVersion =NULL

set @ExeState =0

select Dr.StateID from table1 dR

where

DR.[FileName] = @inFileName

AND DR.FileSize =@inFileSize

AND DR.FileVersion = isnull(@inFileVersion,DR.FileVersion)

AND DR.languageid = isnull(@inlanguageid,null)

AND DR.[ID]= @ID

)

go

set ansi_nulls on

View 3 Replies View Related

Want To Use Parameters To Filter For Dates Between Two (parameter, User-input) Dates

Mar 2, 2006

SQL 2005 Dev

How can I do this with Parameters? I can get a single parameter to filter for a single date (or even a combo list of the dates in DB). But I want my parameters to interact so that they specify a range. Is this possible?

View 3 Replies View Related

T-SQL (SS2K8) :: Calculate Sum Of Dates Minus Repetitive Dates

Jul 18, 2014

Today I have got one scenario to calculate the (sum of days difference minus(-) the dates if the same date is appearing both in assgn_dtm and complet_dtm)/* Here goes the table schema and sample data */

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[temp_tbl]') AND type in (N'U'))
DROP TABLE [dbo].[temp_tbl]
GO
CREATE TABLE [dbo].[temp_tbl](
[tbl_id] [bigint] NULL,
[cs_id] [int] NOT NULL,
[USERID] [int] NOT NULL,

[code]....

View 9 Replies View Related

T-SQL (SS2K8) :: Insert Into Table Dates In Between Two Dates

Feb 28, 2015

I have a table that has hotel guests and their start stay date and end stay date, i would like to insert into a new table the original information + add all days in between.

CREATE TABLE hotel_guests
(
[guest_name] [varchar](25) NULL,
[start_date] [date] NULL,
[end_date] [date] NULL,
[comment] [varchar](255) NULL

[code]...

View 7 Replies View Related

Comparing Dates With Today Dates

Jun 21, 2005

I want to know if there is a way to compare dates in the sql statement with dates that I input into a database and todays date.  the datatype that I'm using is smalldatetime.The statement I used is:Select Date from Table where Date > 'Today.now'I get an errorCould this be done or is there another approach?

View 1 Replies View Related

Enable Error Handling When Writing Custom Source Component /custom Error Handling Component.

Apr 21, 2006

1) We are writing a custome Source component for Oracle with OCI calls, Could some one please let me know how to Enable Error Handling for the Same,

2) Is it possible to write Custome Error Handeling Component for SSIS? if yes could you please help me on how to write it.

Thanks in advance.

View 1 Replies View Related

Reporting Services :: Give Meaning Full Name To Allow Null Value Check Box In Report Parameter Instead Of NULL?

Oct 20, 2015

In my report i have CNAME parameter , which allows null value. I checked Allow null value check box in report parameter properties.

when i preview the report , it displays checked NULL check box beside CNAME parameter . I want to give some meaningful name(i.e.ALLCustomers) to this checkbox instead of NULL. 

Is it possible through SSRS designer?

View 5 Replies View Related

Integration Services :: SSIS Insert Non Null Value Into Null Rows

Jul 15, 2015

I have a flat file with the following columns

SampleID   Rep_Number   Product  Protein   Fat   Solids

In the flat file SampleID and Product are populated in the first row only, rest of the rows only have values for Rep_Number, Protein, Fat, Solids.

SampleID and Product are blank for the rest of the rows. So my task is to fill those blank rows with the first row that has the sampleID and Product and load into the table.

View 7 Replies View Related

Subscription Issue With Null Default Parameter - Key Cannot Be Null

May 3, 2007

I have a report that is run on a monthly basis with a default date of null. The stored procedure determines the month-end date that it should use should it be sent a null date.

The report works fine when I tell it to create a history entry; however, when I try to add a subscription it doesn't appear to like the null parameter value. Since I have told the report to have a default value of null it doesn't allow me to enter a value on the subscription page.

Now, I suppose I could remove the parameter altogether from the stored proc, but then the users would never be able to run the report for a previous time period. Can someone explain to me why default values aren't allowed to be used on subscriptions when they seem to work fine for ad hoc and scheduled reports? This is really quite frustrating as most of my reports require a date value and default to null so that the user doesn't have to enter them for the latest data.



An internal error occurred on the report server. See the error log for more details. (rsInternalError) Get Online Help




Key cannot be null. Parameter name: key

View 1 Replies View Related

Returned SQLParam.SqlValue Is {Null} But Can't Test For Null?

Nov 5, 2007

I run a stored procedure for which I have a return variable. The stored procedure returns the ID of a row in a table if it exists:

m_sqlCmd.ExecuteScalar();

The m_sqlCmd has been fed an SQLParameter with direction set to output.
When the stored proc returns, I want to test it. Now when there IS a row it returns the ID ok.
When the row doesn't exist, in my watch I have:

m_sqlParam.SqlValue with value {Null}

I can't seem to work out how to test this value out.
I've tried several things but none seem to work.

This line compiles ok, but the following runs into the IF statement as if the SqlValue is null??

if (m_sqlParam.SqlValue != null)....
{

// I'm here!! I thought the watch says this is null???
}

Sorry if this is obvious, but I can't work this one out!!

View 3 Replies View Related

Any Improvements To This: Cannot Apply Value Null To Property Login: Value Cannot Be Null.

Mar 26, 2007

Looks like there was a fix and then I read this fix is not a fix. Does anyone know how this can be rectified? Does it mean that only Windows authentiation is the only way it works. The Software is over 2 years old, there are no excuses.

View 1 Replies View Related

Generate Dates Between Two Dates

Nov 8, 2006

Hi,

I have a table which records employees'time-off records. There are 6 columns in this TimeOff table. They are RequestID, EmpName, StartDate, EndDate, Type, NumofDays. I have another table which has all the dates from 01/01/1950 to 01/01/2056.

I am trying write a query which lists all the dates between the timeoff startdate and enddate, including the the start and end dates, but my query so far only lists the start and end date in a timeoff record:

SELECT D.[Date], Datename(dw,D.[Date]) AS Weekday
FROM Dates D LEFT JOIN TimeOff T ON D.[Date] = T.OffStartDate OR D.[Date] = T.OffEndDate
WHERE (OffType = 'Sick Day' AND EmpName = 'Cat White') AND (D.[Date] BETWEEN T.StartDate AND T.EndDate)

Any advice will be greatly appreciated!

View 1 Replies View Related

Getting Individual Dates Between 2 Dates

Mar 4, 2008

Has anyone ever written a function to retrieve all individual dates between two given dates? Using DATEDIFF I can get the number of days between two dates. However I need to iterate through the days to identify weekend and holiday dates. Has anyone ever written a function to do this?

So, if select datediff(d,'07/01/2007','07/15/2007') as NumOfDays returns 14, I'd need to iterate through the 14 days and get the weekends and holidays. Would I have to use a cursor to iterate through the days?

View 13 Replies View Related

Cannot Insert The Value NULL Into Column 'OrderID' -- BUT IT IS NOT NULL!

Apr 2, 2007

I am getting this error: "Cannot insert the value NULL into column 'OrderID', table 'outman.outman.Contact'; column does not allow nulls. INSERT fails." -- But my value is not null. I did a response.write on it and it show the value. Of course, it would be nice if I could do a breakpoint but that doesn't seem to be working. I'll attach a couple of images below of my code, the error, and the breakpoint error.
 

 
 

Server Error in '/' Application.


Cannot insert the value NULL into column 'OrderID', table 'outman.outman.Contact'; column does not allow nulls. INSERT fails.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'OrderID', table 'outman.outman.Contact'; column does not allow nulls. INSERT fails.Source Error:



Line 89: sContact.Phone = sPhone.Text.Trim
Line 90: sContact.Email = sEmail.Text.Trim
Line 91: sContact.Save()
Line 92:
Line 93: Dim bContact As Contact = New Contact()Source File: F:InetpubwwwrootOutman KnifeCheckout.aspx.vb    Line: 91 Stack Trace:



[SqlException (0x80131904): Cannot insert the value NULL into column 'OrderID', table 'outman.outman.Contact'; column does not allow nulls. INSERT fails.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857354
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734966
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlDataReader.HasMoreRows() +150
System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +214
System.Data.SqlClient.SqlDataReader.Read() +9
System.Data.SqlClient.SqlCommand.CompleteExecuteScalar(SqlDataReader ds, Boolean returnSqlValue) +39
System.Data.SqlClient.SqlCommand.ExecuteScalar() +148
SubSonic.SqlDataProvider.ExecuteScalar(QueryCommand qry) +209
SubSonic.DataService.ExecuteScalar(QueryCommand cmd) +37
SubSonic.ActiveRecord`1.Save(String userName) +120
SubSonic.ActiveRecord`1.Save() +31
Checkout.btnCheckout_Click(Object sender, EventArgs e) in F:InetpubwwwrootOutman KnifeCheckout.aspx.vb:91
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

View 8 Replies View Related

Help Altering Database Table From NULL To NOT NULL

Jun 28, 2004

I would drop and add the table but the data can't be deleted. So if anyone could help with the statement it would be greatly appreciated. Thanks

View 7 Replies View Related

Sp_option... 'concat Null Yields Null'

Feb 26, 2004

I'm trying to set the concat... option to OFF
all the time and in all my databases

I tried this command

USE master
EXEC sp_dboption 'DatabaseName', 'concat null yields null', 'FALSE'

but it doesn't change anything

Select NULL + 'TOTO'
----> NULL

(it should be 'TOTO')

View 2 Replies View Related

Change Not Null To Null, Default Value To Empty

Aug 3, 2005

hi,my structure table in database:Amount float(53) not null default 0when i try to run his script:alter table ABC alter column Amount float(53) nullit can only set the Amount to allow null, but can't set the defaultvalue to empty.anyone know how to set the field to allow null and default set toempty, no value.thanks

View 5 Replies View Related

DB Engine :: Not Able To Make Column To Null Value From Not Null

May 13, 2015

It's giving me an error while I'm trying to change column value from not null to null..

'tblid' table
- Unable to modify table.  

Cannot insert the value NULL into column 'ValidID', table 'Xe01.dbo.Tmp_tblid'; column does not allow nulls. INSERT fails.

The statement has been terminated.

View 4 Replies View Related

WITH RETURNS NULL ON NULL INPUT Not Working?

May 3, 2006

Hello.

I've built a sample CLR function with the following declaration....

CREATE FUNCTION GetManager(@DeptCode nvarchar(3))
RETURNS nvarchar(1000)
WITH RETURNS NULL ON NULL INPUT
AS
EXTERNAL NAME Assembly1.[ClassLibrary1.MyVBClass].MyManager

And it works as expected, except when I use NULL:

DECLARE @MyManager nvarchar(1000)
EXEC @MyManager = dbo.GetManager NULL
PRINT @MyManager

It returns the value "Unknown" as it would have for any unknown DeptCode, as-programmed.

I'm of the theory it should have returned NULL without actually firing the function? Or is this only for non-CLR items... or stored procedures, not functions?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved