Datetime Error In SQL

Apr 25, 2008

Hi,
I need a help!!! I am trying to convert string to datetime and i dont know how to...
when i run my stored procedure I got an error message:
Server: Msg 242, Level 16, State 3, Line 45
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

part of my stored procedure that gives me an error message is:

case when b.ClaimStatusCode <> 3
then cc.BenefitEndDate
else NULL end, '00-00-0000' as MaxBenefitDate

So when ClaimStatusCode is NOT closed (claimstatuscode <>3) is going to show cc.BenefitEndDate...but if claim is closed (claimstatuscode = 3) then its going to show '00/00/0000' on the crystal report.

or maybe someone know how to write a formula in crystal report to be able to do this.

Please help!!!! Thank you so much!!!!

~WT

View 11 Replies


ADVERTISEMENT

ERROR:Syntax Error Converting Datetime From Character String. With Stored Procedure

Jul 12, 2007

Hi All,





i have migrated a DTS package wherein it consists of SQL task.

this has been migrated succesfully. but when i execute the package, i am getting the error with Excute SQL task which consists of Store Procedure excution.



But the SP can executed in the client server. can any body help in this regard.





Thanks in advance,

Anand

View 4 Replies View Related

Error 241: Syntax Error Converting Datetime From Character String

Jan 7, 2004

Hi All, can someone help me,
i've created a stored procedure to make a report by calling it from a website.
I get the message error "241: Syntax error converting datetime from character string" all the time, i tryed some converting things but nothig works, probably it is me that isn't working but i hope someone can help me.
The code i use is:


CREATE proc CP_Cashbox @mID varchar,@startdate datetime,@enddate datetime
as
set dateformat dmy
go
declare @startdate as varchar
declare @enddate as varchar

--print "query aan het uitvoeren"

select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@mID' and njdate between '@startdate' and '@enddate'
GO



Thanx in front
Cya

View 14 Replies View Related

Getting Error : : The Conversion Of A Char Data Type To A Datetime Data Type Resulted In An Out-of-range Datetime Value

Jan 28, 2008

update tblPact_2008_0307 set student_dob = '30/01/1996' where student_rcnumber = 1830when entering update date in format such as ddmmyyyyi know the sql query date format entered should be in mmddyyyy formatis there any way to change the date format entered to ddmmyyyy in sql query?

View 5 Replies View Related

Datetime Error

Feb 2, 2004

while executing the following statement:
select convert(datetime,'Nov 31, 2002 10:05pm')
got the following error:
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

the datetime set is mdy
is there any way to make this work though this is not according to the iso standarts.

regards,
harsh.

View 2 Replies View Related

Datetime Error

Oct 15, 2007

declare @table table(c1 int,c2 datetime)


insert into @table (c1,c2) values(1,'14/01/2007')

when i execute this the following error appears:

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

View 5 Replies View Related

DateTime Error

May 14, 2006

I have a function that is based aounr the input of parameters. The last remaing issue is that I am required to enter the data into the parameter field as mm/dd/yyyy. I want to be able to enter the data as dd/mm/yyyy. I have tried to use

WHERE (CONVERT(datetime,src_terrier.datadate,103) = @dt_src_date) AND..........

But this just throws an error "Msg 8114, Level 16, State 1, Procedure spWTRalldatareportsummary, Line 0
Error converting data type nvarchar to datetime."

The execution line I am using is

USE [DashboardSQL-2K5]
GO

DECLARE @return_value int

EXEC @return_value = [dbo].[spWTRalldatareportsummary]
@dt_src_date = N'28/04/2006',
@chr_div = NULL,
@vch_portfolio_no = NULL,
@vch_prop_cat = NULL

SELECT 'Return Value' = @return_value

GO
Anybody got any ideas as to what I have done wrong? I have also tried it without the N just before the date and get a varchar version of the same error.

Thanks in advance

View 5 Replies View Related

Datetime Conversion Error?

Jan 17, 2008

 Hi,
I am getting the following error when
executing the ExecuteInsert in the code below..:
 
Conversion failed when converting
datetime from character string.



    private bool
ExecuteInsert(String quantity)   
{[snip]       
con.Open();       
SqlCommand command = new SqlCommand();       
command.Connection = con;       
TextBox TextBox1 =
(TextBox)FormView1.FindControl("TextBox1");       
Label 1 = (Label)FormView1.FindControl("Label3");       
Label 2 = (Label)FormView1.FindControl("Label13");       
command.CommandText = "INSERT INTO Transactions (etc,Date,etc)
VALUES (etc,@date,@etc)";        
command.Parameters.AddWithValue([snip]);       
command.Parameters.AddWithValue([snip]);        command.Parameters.AddWithValue("@date",
DateTime.Now.ToString());        
command.Parameters.AddWithValue([snip]);       
command.Parameters.AddWithValue([snip]);       
command.ExecuteNonQuery();       
con.Close();       
command.Dispose();       
return true;    }    protected
void Button2_Click(object sender, EventArgs e)   
{        TextBox TextBox1 =
FormView1.FindControl("TextBox1") as TextBox;       
bool retVal = ExecuteUpdate(Int32.Parse(TextBox1.Text));       
if (retVal)           
Response.Redirect("~/URL/EXTENSION.aspx");       
Insert();    }    private
void Insert()    {       
TextBox TextBox1 = FormView1.FindControl("TextBox1") as
TextBox;       
ExecuteInsert(TextBox1.Text);    }}  Thanks if someone can help!Jon

View 2 Replies View Related

Datetime Overflow Error

Feb 26, 1999

When doing a DATEDIFF on two dates, I get the error:

Msg 535, Level 16, State 0
Difference of two datetime fields caused overflow at runtime.

I have tracked the error down to a field in a couple of records out of several thousand records.

I don't know how to fix it the problem. BOL describes the error as a field having the wrong datatype that both datatypes are DATETIME.

Running: SQL Server 6.5 with SP4.

Any help is appreciated because we are going into code freeze this afternoon and going live next week.

TIA,
Virginia

View 1 Replies View Related

Error Using CONVERT(DATETIME,....

Dec 9, 2005

I have a stored procedure that takes a @INPUT_DATE Varchar(25) as an input parameter. It passes this @Date to a User Defined function that checks if @Date is a valid date and then returns either the date or a "1" for not a valid date. If it is not a valid date, I use the RAISERROR and stop the insert call.

Here is the parts from the Stored Procedure


Code:

--Input Parameter
@INPUT_DATEvarchar(25) = NULL,

--Send the Parameter to the User Defined Function
DECLARE @Error AS INT
DECLARE @ErrorMessage AS VARCHAR(200)


--Check to make sure a all dates are entered correctly
SET @INPUT_DATE = dbo.Function_Check_Date(@INPUT_DATE)

IF (@INPUT_DATE = '1')
BEGIN
SET @Error = 1
SET @ErrorMessage = '-Date formatted wrong'
RAISERROR(@ErrorMessage, 15, 1)
END
-------------------------------------------------------

IF @Error <> 1
BEGIN
INSERT INTO Table1(DateColumn)
VALUES (CONVERT(DATETIME, @INPUT_DATE))



And here is my User Defined Function


Code:

CREATE FUNCTION [dbo].[Function_Check_Date]
(
@Temp VarChar(25)
)
RETURNS VARCHAR

AS

BEGIN
DECLARE @Date VarChar(25)

IF (ISDATE(@Temp) = 0) AND (@Temp <> 'N/A') AND (@Temp <> '')
BEGIN
SET @Date = '1'
END
ELSE IF (@Temp = 'N/A') OR (@Temp = '') --For not availables or Blanks
BEGIN
SET @Date = CONVERT(DATETIME, '1/1/1900')
END

ELSE
BEGIN
SET @Date = CONVERT(DATETIME, @Temp)
END

RETURN @Date

END






The error is occuring when I try to convert the @INPUT_DATE to a datetime in the insert statement. The field value for the DateColumn in the database is a DateTime format. The error I receive is Error Converting datetime from character string. But when I test all these items in Query Analyzer, I am able to do each step without error?

Thanks for any advice, as I am rather confused.

View 5 Replies View Related

Convertion Datetime Error

Jan 29, 2008

i am getting error while convering datetime datatype using

convert(x,101)
function

Arithmetic overflow error converting expression to data type datetime

please help me

View 11 Replies View Related

Error With Datetime Datatype

Oct 31, 2006

Hi Guys,

I'm having problem in loading textfile into the database. One of the columns in the textfile has a datetime datatype.

Here is a sample of the text file. All the other columns are string except for the datetime: "5/4/2006"

"1","1","ITEM","5/4/2006","10:05:04","11110",10004,"Regular Half Chicken",1,130.00,0,0


Error is shown below.

Error: 0xC0202009 at Data Flow Task, OLE DB Destination [154]: An OLE DB error has occurred. Error code: 0x80004005.

An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification".

Error: 0xC020901C at Data Flow Task, OLE DB Destination [154]: There was an error with input column "Transaction_Date" (1233) on input "OLE DB Destination Input" (167). The column status returned was: "The value could not be converted because of a potential loss of data.".

Error: 0xC0209029 at Data Flow Task, OLE DB Destination [154]: The "input "OLE DB Destination Input" (167)" failed because error code 0xC0209077 occurred, and the error row disposition on "input "OLE DB Destination Input" (167)" specifies failure on error. An error occurred on the specified object of the specified component.

Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: The ProcessInput method on component "OLE DB Destination" (154) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0xC0209029.



Please help!!!

Thanks in advance,

Larry

View 7 Replies View Related

Error In Datetime Conversion

May 21, 2008

Hi everyone,

I have a problem with a datetime field.
In the database is stored as datetime (121 format) ex. 2008-05-20 17:30:00.000
I have a simple select query (no datetime conversions used) and the result I get from the report looks like 5/20/2008 5:30 PM.

I dont want this format so i use this custom dd:MM:yyyy hh:mms

After that i get the dates like this 5/20/2008 5:30 instead of 17:30.

Any suggestions appreciated...



View 1 Replies View Related

Default Datetime Error

Mar 21, 2007

hi friends,

i have two datetime parameters in my report ... based on these parameters , am searching records ... the issue is i cant get the full datetime value

for example

i am searching records based on 03/16/2007 and 03/20/2007... i can't the records for the date 03/20/2007...

bcoz, the value of the date is '03/20/2007 00:00:00.000'

i want to get the value like this ' 03/20/2007 11:59:59 pm''

can any one help me

View 6 Replies View Related

Error Sql Excpetion Datetime.now Could Not Be Bound..

Apr 7, 2008

I am trying to call a userdefined function and it excepts and date like 4/15/2007 but when i call my function i get an error

the multipart identifier datetime,now could not be bound
and this is my codePublic Function GetPeriods()
Dim myconnection As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings(APPSETTING_DBCONNECTION))
Dim query1 As String = "Select dbo.udf_Quarter(Datetime.Now)" 'Max(PeriodId) From Period"
myconnection.Open()
Dim MaxPeriodId As Integer
Dim cmd As New SqlCommand(query1, myconnection)
cmd.CommandType = CommandType.Text
MaxPeriodId = cmd.ExecuteScalar()
Response.Write(MaxPeriodId)
Session("PeriodId") = MaxPeriodId

Return (MaxPeriodId)

End Function any help will be appreicated
Regards,
Karen

View 2 Replies View Related

Error In Query--datetime Related

May 21, 2008

Hi y'all I have a problem in my query.This is my querySELECT     dbo.BOS_GL_Workplace.WpszState, Emp2.szName, Emp1.szName AS szEmpName, Emp1.szEmployeeId,                     dbo.BOS_PI_Division.szName AS Divisi, dbo.BOS_PI_Team.szDescription,dbo.BOS_SD_Route.szRouteId, dbo.BOS_SD_Route.szDescription, dbo.BOS_SD_Route.szScheduleId,                    dbo.BOS_SD_RouteItem.szCustId, dbo.BOS_SD_Route.szOpUserId,dbo.BOS_AR_Customer.szCustId ,dbo.BOS_AR_Customer.szName, dbo.BOS_AR_Customer.CustszAddress_1 AS AlamatKirim, dbo.BOS_AR_Customer.szTaxId,                     dbo.BOS_AR_Customer.CustszAddress_1 AS AlamatTagih, dbo.BOS_AR_Customer.CustszCity, dbo.BOS_AR_Customer.CustszZipCode,                     dbo.BOS_AR_Customer.szStatus, dbo.BOS_AR_CustSales.szPaymentTermId, dbo.BOS_AR_CustSales.decCreditLimit,BOS_AR_Customer.dtmStart,BOS_AR_Customer.dtmLastUpdated                    FROM         dbo.BOS_PI_Employee Emp1 LEFT OUTER JOIN                    BOS_PI_Employee Emp2 on Emp1.szSupervisorID = Emp2.szEmployeeID Left outer join                     dbo.BOS_GL_Workplace ON Emp1.szWorkplaceId = dbo.BOS_GL_Workplace.szWorkplaceId LEFT OUTER JOIN                     dbo.BOS_PI_Division ON Emp1.szDivisionId = dbo.BOS_PI_Division.szDivisionId LEFT OUTER JOIN                     dbo.BOS_PI_Team ON Emp1.szTeamId = dbo.BOS_PI_Team.szTeamId LEFT OUTER JOIN                     BOS_SD_Route on Emp1.szEmployeeId = BOS_SD_route.szOPuserId LEFT OUTER JOIN                    BOS_SD_RouteItem on BOS_SD_Route.szRouteId = BOS_SD_RouteItem.szRouteID LEFT OUTER JOIN                    BOS_AR_Customer on BOS_SD_RouteItem.szCustID = BOS_AR_Customer.szCUstID LEFT OUTER JOIN                    BOS_AR_CustSales on BOS_AR_Customer .szCustId = BOS_AR_CustSales.szCustID When I run that query, it was working fine the result was correct. Then I tried to add the where clause, like this:WHERE BOS_AR_Customer.dtmLastUpdated >= '8/1/2006' AND BOS_AR_Customer.dtmLastUpdated <='9/21/2007'And it was also working fine, the result was also correct--pay attention dudes the date format is mm/dd/yyyyThen I try to change the date format to dd/mm/yyyy in the where clause like this (because later I realized that, this is the query that gonna be used):WHERE BOS_AR_Customer.dtmLastUpdated >= '1/8/2006' AND BOS_AR_Customer.dtmLastUpdated <='21/9/2007'The result was an error message saying:"The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."Can you tell me whats wrong, please. I appreciate anykinds of help guys, thanks. FYI : I use SQL SERVER 2000 Best Regards.  

View 1 Replies View Related

Error Converting Datetime To String.

Jun 6, 2008

I have a dropdown list thats boudn to a SqlDataSource.  The DataSource looks like this:
  <asp:SqlDataSource ID="dsProgramList" runat="server" ConnectionString="<%$ ConnectionStrings:csData %>"
SelectCommand="SELECT DISTINCT [Program_Name] +','+ [Begin_Date] AS NAMEandDATE, [Course_ID], [LOC] FROM [ThisTable] WHERE ([LOC] = @LOC)">
<SelectParameters> 
 
Where the dropdownlists text = NAMEandDATE and its value = Course_ID
When I select the LOC from the LOCdropdownlist, the dropdownlist in question updates, and an error "Erro converting datetime from character string" happens?
Any suggestions?

View 4 Replies View Related

Run Time Error: Out-of-range Datetime Value

Nov 26, 2003

Hi everyone, this is the exception:

System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value

Here's my code!

... 'datagrid code
cmdSelect.CommandText = "SELECT * FROM [Table] WHERE [Date and Time] > '" & Me.tbFromDate.Text & "' AND [Date and Time] < '" & Me.tbToDate.Text & "'"
...


Me.tbFromDate.Text and Me.tbFromDate.text look like this: 27/11/2003 1:11:43 PM

The SQL Query works fine - just that this code gives a runtime error.

Can someone help?? I'm guessing I have to do somekind of conversion!!

Andrew

View 1 Replies View Related

DateTime Error In Stored Procedure

Apr 15, 2004

Hi;

I have a stored procedure simply adds userid,logintime and status to db but I have an error when running procedure can you help me please??

Create Procedure AddLog
(
@User char(10),
@DLogon DateTime(8),
@Status bit
)
As
Insert Into Log(UserID,LogInTime,Online)
Values(@User,DLogon,Status)

ERROR:

Server: Msg 128, Level 15, State 1, Procedure AddLog, Line 9
The name 'DLogon' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

View 1 Replies View Related

Error Retrieving Datetime Value From SQL Server

Sep 13, 2005

Please HELP!
On my asp.NET page I'm setting a datetime variable to Now() and inserting that value into SQL Server as a datetime stamp.  I want to then retrieve the count of the number of records that were inserted into the table that have that value.   The field in the table is just a datetime datatype.But it's returning 0 records because the Now() value is getting converted to military time and losing the seconds!  For example, Now() is "9/13/2005 2:48:25 PM" but the value being inserted into the table is "2005-09-13 14:48:00.000".ARRRGGHH!  What am I missing??  What do I need to do to be able to (1) keep the seconds, and (2) identify the records in order to retrieve them?Thanks in advance for your help!!!Lynnette

View 11 Replies View Related

Error Updating A DateTime Field

Oct 11, 2005

Hi, I'm having trouble updating a DateTime field in my SQL database.  Here is what I'm trying to do....I retrieve the existing value in the DateTime field (usually a bum date like 1/1/1900 00:00:00:00), then put it in a variable.  Later, depending on some conditions, I'll either update the DateTime field to today's date (which works great) or set it back equal to the existing value from the variable (this one messes up and says "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. ").  There is a ton more than this but here are the relevant snippets:<code>Dim CompDate As DateTimeDim aComm As SQLCommand Dim aReader As SQLDataReader Dim bSQL,bConn As String bSQL= "SELECT CompleteDate,StatusOfMarkout FROM Tickets WHERE TicketName=" _ & CHR(39) & Trim(Ticket.Text) & CHR(39) bConn = serverStuff aConn = New SQLConnection(bConn) aComm = New SQLCommand(bSQL,aConn) aConn.Open() result = aComm.ExecuteReader() 'fills controls with data While result.Read()    CompDate = result("CompleteDate")    PreviousMarkoutStatus.Text = result("StatusOfMarkout") End While result.Close() aConn.Close()sSqlCmd ="Update OneCallTickets CompleteDate=@CompleteDate, StatusOfMarkout=@StatusOfMarkout WHERE TicketFileName=@TicketFileName" dim SqlCon as New SqlConnection(serverStuff) dim SqlCmd as new SqlCommand(sSqlCmd, SqlCon) If Flag1List.SelectedItem.Value = "No Change" Then    SqlCmd.Parameters.Add(new SqlParameter("@Flag1", SqlDbType.NVarChar,35))    SqlCmd.Parameters("@Flag1").Value = PreviousMarkoutStatus.Text    SqlCmd.Parameters.Add(new SqlParameter("@CompleteDate", SqlDbType.DateTime, 8))    SqlCmd.Parameters("@CompleteDate").Value = CompDateElse   SqlCmd.Parameters.Add(new SqlParameter("@Flag1", SqlDbType.NVarChar,35))    SqlCmd.Parameters("@Flag1").Value = CurrentStatus.Text    SqlCmd.Parameters.Add(new SqlParameter("@CompleteDate", SqlDbType.DateTime, 8))    SqlCmd.Parameters("@CompleteDate").Value = Today()End IfSqlCon.Open() SqlCmd.ExecuteNonQuery() SqlCon.Close()</code>Can anybody help me with this?  Thanks a bunch

View 7 Replies View Related

SQL Query Error - Datetime Timestamp??

Oct 3, 2007

So, what's wrong with this datetime syntax to the sql query? I'm getting error here..


Code:


insert into tbl_database_profile
(latest_date, version)
values
(datetime, '1')



The datatype for the field "latest_date" is datetime....

Thanks...

View 3 Replies View Related

Conversion From CHAR To DATETIME Error

Feb 14, 2006

on a column DateNew = DateTimei am trying :INSERT INTO [dbo].[Users] (DateNew) VALUES ('2003/01/31 10:04:14')and i get an error :conversion of char data type to datetime data type resulted in an out of range datetime valueI had never this error before , do you know why ?i must enter a yyyy/mm/dd format because this database will be used for Fr and Us langagesthank you for helping

View 14 Replies View Related

Conversion Error...nvarchar To Datetime

Jul 23, 2005

Hi Group,I am new with SQL Server..I am working with SQL Server 2000.I am storing the date in a nvarchar column of atable.... Now I want toshow the data of Weekends..Everything is OK...But the problem isarising with Conversion of nvarchar to date...to identify theweekends...Like..Here DATEVALUE is a nvarchar column...But getting theerror..Value of DATEVALUE like dd-mm-yyyy...04-08-2004-----------------------------------------------------------Server: Msg 8115, Level 16, State 2, Line 1Arithmetic overflow error converting expression to data type datetime.---------------------------------------------------------------------------Actual Query-------------------------------Select DATEVALUE,<Other Column Names> from Result whereDatepart(dw,convert(Datetime,DATEVALUE))<>1 andDatepart(dw,convert(Datetime,DATEVALUE))<>7-----------------------------------------------------------Thanks in advance..RegardsArijit Chatterjee

View 3 Replies View Related

Error:the String Was Not Recognized As A Valid DateTime.

Aug 31, 2007

hi all, i'm trying to insert the time/date a button was clicked on a gridview and it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0 i have changed the culture to en-US but it still doesn't work. i actually created the date/time column after some data had been entered into the table so the column allows nulls. this is my code:InsertCommand="INSERT INTO test101(Surname,Names,Registration,Login Time)VALUES (@Surname, @Names, @Registration,@Login_Time)"<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now Type=DateTime Name="Login_Time" /></Insert Parameters>any suggestions?

View 9 Replies View Related

ASP.Net, SQL, Using Datetime Objects As Variables (keeps Throwing Error)

Feb 20, 2008

Sorry seem to be havign no end of trouble with SQL today. I need to create a query that will rank tickets using the row count of another table which has a relationship with the primarykey of that ticket table. I decided to spilt it into two querys, one which gets the count each ticketid has within a date peroid and relating to a os:: SELECT     COUNT(*) AS count, Tickets.TicketID, Systems.OSFROM         Rating INNER JOIN                      Tickets ON Rating.TicketID = Tickets.TicketID INNER JOIN                      Systems ON Tickets.SystemID = Systems.SystemIDWHERE     (Rating.DateVoted >= @date)GROUP BY Tickets.TicketID, Systems.OSHAVING      (Systems.OS = @osid) This works, BUT when I put in the date using: command.CommandText = "SELECT COUNT(*) AS count, Tickets.TicketID, Systems.OS FROM Rating INNER JOIN Tickets ON Rating.TicketID = Tickets.TicketID INNER JOIN Systems ON Tickets.SystemID = Systems.SystemID WHERE (Rating.DateVoted >=" + Datetime.Now.Adddays(-7) + ") GROUP BY Tickets.TicketID, Systems.OS HAVING (Systems.OS =" + 1 + ")"; And it throws up an error saying there was a syntax error at '22' (the hour I am currently on). So: Any idea how I can fix thisAny ideas on creating a query that will do the above, but also return the ticket informationHow do you link querys (I might have to do this if I can't work out 2)Please, If anyone has any ideas. This is driving me crazy 

View 5 Replies View Related

Error In Viewing Datetime Value In Gridview Itemtemplate

May 9, 2008

Hi!

I am trying to show the StartTime and the EndTime in one column.

Start - End
9:00:00 - 10:00:00

I tried the following code, but it is returning an error.


<asp:TemplateField HeaderText="Start - End">
<ItemTemplate>
<asp:Literal ID="litTimeRange" runat="server" Text='<%# Eval("timeRange") %>'>
</asp:Literal>
</ItemTemplate>
</asp:TemplateField>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
SelectCommand="SELECT ID, ([StartTime]+ ' - ' + [EndTime]) as timeRange, CompanyName, Purpose, AccountManager, Presenter, ColorCode, Status, Comments FROM Demo_Theatre_DB WHERE (StartTime &gt;= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (StartTime &lt;= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1))">
</asp:SqlDataSource>



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

[SqlException (0x80131904): The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
System.Data.SqlClient.SqlDataReader.HasMoreRows() +150
System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +212
System.Data.SqlClient.SqlDataReader.Read() +9
System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +153
System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +153
System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +170
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +175
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041


Your will be appreciated.

Thanks!

View 3 Replies View Related

Datetime Error Inserting Inql Server Plz Help

May 28, 2008

i use this statement to insert into sql tablecmdInsert = New SqlCommand("insert into empbill ([deptcode],[personNo,[entrydate]] ) values(" & Val(eno.Text) & "," & Val(TextBox5.Text) & ", " & dd.Text  & "')", db)
cmdInsert.ExecuteNonQuery()
dd.Text   value is 22/5/2008  it come from datetime calender
the  entrydate field datatype is datetime
i found data always 1/1/1900 00:00:00
how i enter my date

View 10 Replies View Related

How To Solve An Error While Converting Nvarchar To Datetime

Apr 8, 2004

HI,
I HAVE BEEN TRYING TO TRANSFORM AN OLD TABLE TO A NEW FORMAT AND CHANGE SOME OF THE DATATYPE FORMATS USED IN THE OLD ONE.
OUT OF WHICH ONE IS A COLUMN CALLED AS FORM_RECEIVE_DATE WHICH HAS NVARCHAR(41) AS DATATYPE IN THE OLD TABLE CREATED BY A PREVIOUS DBA (DON'T KNOW wHY?)

wHILE CONVERTING IT INTO DATATYPE DATETIME , I AM GETTING THIS ERROR :- "Arithmetic overflow error converting expression to data type datetime." i DON'T KNOW WHY

hERE ARE FEW EXAMPLES OF THE DATA CONTAINED IN THE PREVIOUS TABLE :-

05082003
05062003
05142003

COULD YOU PLS TELL ME A WAY TO SOLVE THIS ?

View 4 Replies View Related

T-SQL (SS2K8) :: Error Converting Datetime To String

May 29, 2014

I am trying to create a stored procedure that Pulls in Chargeable and Non Chargeable hours for our employees however When I run the Stored Procedure I get this error "Conversion failed when converting date and/or time from character string." I am having a hard time figuring out were this is happening in the Stored Procedure. Also I would like to be able to Add a parameter that would be the StartDate and EndDate for which the stored procedure would pull time for.

ALTER PROCEDURE [dbo].[Chargeability]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

[Code] ......

View 9 Replies View Related

Syntax Error Converting Datetime From Character St

Jun 4, 2007

Probably one of the easiest queries some have seen around, but good ol' MS and their dates. I can't get around this error on this simple query. It will be a job that will run probably several times a day. I haven't even gotten passed to the second part of it....I've also seen this error is a VERY popular error, even with advanced programmers it seems. WOW. Basically, I want to keep the row count to 2 days. Well, if you have any suggestions, I'd take 'em. Thanks!

Delete from tblCallIndexes where inum in
(select inum from tblCalls where StartedAt < 'DATEADD(d,-2,GETDATE())')

View 14 Replies View Related

Using VB 6.0 And SQL Server: Date Causes Datetime Conversion Error

May 10, 2008

I'm using a VB 6.0 front end with a date variable
that throws a SQL 2005 datetime conversion error in the following UPDATE query:

UPDATE MYTable
SET Feild1 = 'VBVar1', Field2='VBVar2'
WHERE MydateField = 'VBdateVar'

I'm guessing that I probably am missing some appropriate method for passing the date datatype variable to SQL


Can anyone help me

Thanks

View 7 Replies View Related

Passing DateTime Parameter To Subreport (Error)

Feb 21, 2007

Hi guys,

I have managed to pass a string parameter form the main report to the subreport with no problems, but when i try and use the same method to pass a datetime type, i am issued with the following error messase:

"[rsErrorExecutingSubreport] An error occurred while executing the subreport €˜SubReportName€™: The value provided for the report parameter 'MasterDate' is not valid for its type."

I cant see why it work for strings, but not for datetime. Any suggestions will be very much appreciated

View 7 Replies View Related







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