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
ADVERTISEMENT
Aug 1, 2007
I have a flat file that I'm reading from and loading my tables with. In that file I have a column that has numbers (2000,1999,1998 and so on) and the column that they are being loaded into is defined as an INT. The issue I'm running into is that the first 50 or so rows in the flat file is empty for this column so I'm getting an error message. If I put numbers in that column in the flat file it works, if i remove them it fails. How can I allow for NULL values for my INT column on the database table?
here is the error I'm getting:
[OLE DB Destination [182]] Error: There was an error with input column "SalesYear" (7259) on input "OLE DB Destination Input" (195). The column status returned was: "The value could not be converted because of a potential loss of data.".
View 12 Replies
View Related
Sep 27, 2007
I have an SP that I call via table adapter. If I do not pass a value in the string field ('eventRef'), the SP never gets called - it appears that the table adapter is filtering it...? I need to be able to count records that have an 'eventRef' = to the one I pass, including null. This works fine if I pass an 'eventRef', but never runs if that parm is empty.
Here is the TA definition
<asp:ObjectDataSource ConvertNullToDBNull="true" ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="ImagesByEventTableAdapters.PagedImagesByEvent" OnSelecting="ObjectDataSource1_Selecting" OnSelected="ObjectDataSource1_Selected">
<SelectParameters>
<asp:QueryStringParameter Name="CategoryID" QueryStringField="CategoryID" Type="Int32" DefaultValue="24"/>
<asp:QueryStringParameter Name="EventID" QueryStringField="EventID" Type="Int32"/>
<asp:QueryStringParameter Name="EventRef" QueryStringField="erf" Type="String"/>
<asp:QueryStringParameter Name="PageIndex" QueryStringField="PageIndex" Type="Int32" DefaultValue="0"/>
<asp:Parameter Name="NumRows" Type="Int32" DefaultValue="16"/>
<asp:Parameter Name="ImageCount" Direction="Output" Type="Int32" DefaultValue="0" />
</SelectParameters>
</asp:ObjectDataSource>
And the SP:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[PagingGetProductsByEvent]
@CategoryID INT,
@EventID INT,
@EventRef CHAR(10)=NULL,
@PageIndex INT,
@NumRows INT,
@ImageCount INT OUTPUT
AS
BEGINdo my stuff....
View 1 Replies
View Related
Oct 17, 2005
Hello,
I have a BIT column which accepts NULL values.
What would be a good method to allow an INSERT (or UPDATE) statement to insert NULL into this column but then automatically change the NULL to 0 (zero). In other words, test for NULLs after INSERT (or UPDATE) and change the value to 0 (zero).
Not exactly sure how to do this with a Trigger. Also, what is that [Formula] option used for (column properties in the Table Design view)... and would this apply with my problem?
Thanks,
View 2 Replies
View Related
Dec 28, 2006
Hello,I have a foreign key constraint between two tables (Appointments andMissedAppointmentReasons) and I'd like to allow null values in Appointmentstable for the field containing the MissedAppointmentReason, but currently, Iget a Foreign Key Constraint Error when I try to add a record to theAppointments table.Any ideas how I can have the null values but still maintain the Foreign KeyConstraint?Thanks!Rick
View 3 Replies
View Related
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
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
View Related
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
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
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
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
Aug 20, 2007
how can i setup an input field and SQL column to allow a user to enter something such as: '1+' into the field and the db? i get an error due to the '+'.
View 1 Replies
View Related
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
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
Nov 25, 2006
I created an UPDATE trigger on a table - but there one case where I would not the trigger to occur. I mean, in one procedure it may update this table and I would not the trigger to occur a update occurred because of this stored procedure. I could alter my trigger but I am not sure if I would be able to tell which procedure caused it without adding a special column, but if I have to I will.
View 2 Replies
View Related
Apr 6, 2004
Hey all.
I'm trying to set up SQL Server so that people with Enterprise Mgr can create a DB registration to their DB only (sql.yoursite.com). Are there any tutorials out there for doing this?
Thanks for the help!
View 3 Replies
View Related
Apr 16, 2008
I have databases
TESTDB db owner testuer
Login testuser
When right clicking on logins i see dbo
When open this i see testuser
So i clicked on Role Members db_backupoperator was denied
had to do it on the owner schema and select db_backupoperator
Not sure why the role member is permitted.
View 10 Replies
View Related
Apr 18, 2008
Hi All,
I installed full version of SqlServer 2005. Iam able to Connect to all the systems that are in Intranet. But iam not able to Connect to the external systems (or) remote Connections. I followed all the steps that are in the following URL support.microsoft.com/kb/914277
Still iam getting the problem. Show me a way in this issue.
Thanks&Regards,
SrinivasReddy
View 3 Replies
View Related
May 28, 2008
Hi All,
I have written a windows service using VB.NET that connects to a database and performs several tasks. The service is working correctly and has been fully tested against SQL Server 2000. I have recently moved to SQL Server 2005 and now, the service will not connect to the database.
I have setup and tried several different users, but none work, I get the following message:
Login failed for user 'OEESYSTEMS'
The server instance, username and password I specify are all correct.
The service is running on the same server as SQL Server. I can connect through a web application, and through ODBC. The server is set to use SQL server and windows authentication, and is setup and successfully allows remote connections.
It looks like SQL server sees that a windows service is trying to connect and does not allow it.
For the love of god, can anyone help with this issue.
Thank you.
View 1 Replies
View Related
Mar 3, 2007
TITLE: Connect to Database Engine
------------------------------
Cannot connect to FRI-0503SQLEXPRESS.
------------------------------
ADDITIONAL INFORMATION:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=10061&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
I have recieved this error and i have changed the surface area configuration to allow remote connections but it still won't allow them after i start and restart the server service. is there any way to fix this i have reinstalled several times and that has not yet fixed the problem either.
View 5 Replies
View Related
Mar 3, 2007
TITLE: Connect to Database Engine
------------------------------
Cannot connect to FRI-0503SQLEXPRESS.
------------------------------
ADDITIONAL INFORMATION:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=10061&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
this is the error message i get and i don't know how to correct it. i have tried going into surface area configuration and setting it allow remote connections but that hasn't changed anything. i am at a loss for how to correct this situation.
View 1 Replies
View Related
Apr 18, 2006
Please forgive my post, as I am not a network tech, however I provide pc support to the city offices where I live and they are in need of help.
Physical box and pc's moved to a new location. All setup with proper cabling, etc. At first log on after the move all users to log on as normal, a day or two later, only the Administrator can log on and there is only one administrator profile.
Any duh quick fixes to check out, as this brings down 4 city offices.
Thanks in advance.
View 4 Replies
View Related
Apr 18, 2008
Hi All,
I Installed full version of SqlServer 2005. Iam able to connect to all of our systems which are in intranet. But iam not able to connect to external system. I performed all the steps that are mentioned in the following URL support.microsoft.com/kb/914277 . Even then i was not able to connect to the remote systems. I request you to show me a solution to this issue.
Thanks&Regards,
SrinivasReddy.Tadi
View 1 Replies
View Related
Jun 12, 2001
Developers want to give users the ability to schedule and run processes, which may be executables, T-SQL, DTS, Active Scripting, etc. I don't want to enable a proxy account due to the well documented security problems. Has anyone come up with a good way to do this?
View 1 Replies
View Related
Nov 13, 2003
I am trying to make a connection to sql server using sspi (windows authentication), however, I do not wish to use the built in tokenauthentication system. Administrators are worried about somebody using an unattended logged on computer to gain access to the database. So I am left with using sql server authentication (which I am not fond of doing, more password administration) or what I would like to do is use windows authentication but make the user enter thier windows password prior to logging into sql server. Is there a way? Thanks in Advance.
Kent
View 2 Replies
View Related
Jul 11, 2006
I'm relatively new to administering SQL Server, hence this basic question.
What are the standard practice tool(s)/methods for allowing users access to a database to edit data? In this case, these are engineers (not programmers) that need to edit some values. The practice in the past has been to install Enterprise Manager on their PC. However, this does not seem proper to me and I was thinking more along the lines of having them use Access instead.
I compare Enterpise Manager in SQL Server as an equilvalent to Enterprise Manager in Oracle - these are tools only for use by database administrators. Is this a correct correlation, or is Enterpise Manager in SQL Server a tool that users (and programmers?) are commonly allowed to use? In the case of common users, I would think not.
Thanks in advance.
View 3 Replies
View Related
Jan 26, 2004
Hi guys,
Is there anyway to allow SQL Server users to change their own passwords without giving them rights to "db_securityadmin" ?
Our M$ adviser suggested creating our own app using SQL NS and DMO to do it.
Is there any easier method, reference, download sample from the web?
View 3 Replies
View Related
Mar 30, 2007
I would like to allow a particular user to truncate a log file in astored procedure that the user runs every day. At this moment the onlypersonnel that can truncate the log file are personnel with sysadminrights. Is there any way to do this in sql server 2005 withoutgranting this user sysadmin rights (something we REALLY don't want todo)? Thanks for all your help in advance.Dave C.
View 1 Replies
View Related
Jul 20, 2005
With MS SQL 2000 Enterprise Manager, is there a way to allow a user accessto only a few tables, but deny the user access to the rest without having togo to all of the tables and denying access? The database has roughly 50tables, but only 3 should be granted to the new user, so as you can see itwould be a painstaking task to manually do this with the *cough* mouse. Or,if I can run some sort of grant script, that would work too. Thank you!
View 2 Replies
View Related
Aug 29, 2006
Is there a way to automatically setup SQL Server Express to allow remote connections during the installation process?
We are deploying SQL Server Express with our application and I really can't ask SMB customers to go through a series of rather complicated steps after our "turn key" setup installs everything in order for any of the other computers in their office to connect.
What's the reasoning behind that, anyway? Why create a database server setup which by default doesn't allow anyone except the server to access it? I guess that makes sense for ASP.NET but the web fad isn't the only platform developers use these days.
Any assistance would be greatly appreciated.
Cheers,
Evan
View 1 Replies
View Related
Apr 30, 2008
Is there a way to tell an ALTER TABLE statement that truncating data from a string or binary column is okay? Meaning, if I have a NVARCHAR(50) column and I want to change it to NVARCHAR(10), any strings over 10 characters can safely be truncated to 10?
Or do I have to push the columns though an intermediary first?
View 4 Replies
View Related
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
Jul 4, 2006
i have default.aspx file and i put SqlDataSource into my designer form.when i want to configure SqlDataSource it not allowed my to insert, update and delete only insert is allowed.what is the problem and the solution for this case ...thx
View 1 Replies
View Related