An Overflow Occurred While Converting To Datetime. Error?
Mar 30, 2007
I am using SQLCE for a backend database for a desktop application. I have a data entry form which is using a DateTimePicker control that is bound to a Date field in my table. It defaults to Todays date. I cant seem to consistently reproduce the behavior but occastionally when I try to save the data via...
Me.Validate()
Me.BindingSource.EndEdit()
Me.TablAdapter.Update(Me.DataSet.MyTable)
it will throw the error...
"An overflow occurred while converting to datetime."
So even though I could enter several records, when I save the data, this error throws and I lose all the new records I have entered.
Does anybody have a clue as to what the heck could be causing this error? If so, any ideas how I can fix it? When looking at the data the dates all seem to be entering properly into the database?
Thanks
Mike
View 7 Replies
ADVERTISEMENT
Jan 15, 2008
32 Bit Vista RTM - Patch Level up todate. - Desktop
SQL CE V3.5
VS2008 - RTM
I have a really strange problem where I am receiving a ""An overflow occurred while converting to datetime Exception."
I have an existing database where I am making a copy of an old row, and updatting date/time fields. The old fields were filled with date/time and the columns are datetime columns.
Private Function CopyChildRowsDST(ByVal SearchID As Guid, ByVal CurrentParentID As Guid, _
ByVal dsttbl As DataTable) As Boolean
Dim Rows() As DataRow = Ds.Tables("SrcTbl").Rows.Find(SearchID).GetChildRows(ChildrenRel)
Dim NewEntityId As Guid
For Each Row As DataRow In Rows
NewEntityId = Guid.NewGuid
Row(MDTbl.cgParentID) = CurrentParentID
Select Case Row(MDTbl.csRecordType)
Case RecordTypes.Directory
CopyChildRowsDST(Row(MDTbl.cgEntityID), NewEntityId, dsttbl)
Case RecordTypes.Topic
' Increment reference count and ticks of data
Qury.IncrementReferenceCount(Row(MDTbl.cgDataID), _
ReferenceCount.Increment, Tables.DocumentTable)
End Select
Dim Rw As DataRow = dsttbl.NewRow : Rw.ItemArray = Row.ItemArray
Rw(MDTbl.cgEntityID) = NewEntityId
' Rw(MDTbl.cdtDateCreated) = Curtime
'Rw(MDTbl.cdtDateModified) = Curtime
dsttbl.Rows.Add(Rw)
Next
End Function
After executing this code..... I do ...
Public Function PersistTable(ByVal Table As DataTable) As Boolean
' SqlCe.PersistTable - called by any routine needing to make
€˜permanent changes in a table.
' Usually this would be midlevel procedures in IOSUBS
Con.Open() : Dim Status As Boolean
Using Adapter = New SqlCeDataAdapter("Select * from " &
Table.TableName & " ;", Con)
Adapter.UpdateCommand = New SqlCeCommand("Update " &
Table.TableName & " ;", Con)
Dim builder As New SqlCeCommandBuilder(Adapter)
With builder : .QuotePrefix = "[" : .QuoteSuffix = "]" : End With
Try
Adapter.Update(Table) : Status = True
Catch e As SqlCeException
Con.Close()
MsgBox("Error persisting Table: " + Table.TableName + vbCrLf
+ "Exception was: " + e.Message, _
MsgBoxStyle.Information,"ADONET.PersistTable")
Return False
Finally
Con.Close()
End Try
Return Status
End Using
End Function
If I include the two redlines of code, I recieve a time overflow exception WHEN UPDATING THE TABLE. Those database fields are datetime fields and the orginal rows have datetimes in them.
Does anyone understand what is happening?
Thank you.
View 17 Replies
View Related
Sep 20, 2006
Hi all,In the beginning of this month I've build a website with a file-upload-control. When uploading a file, a record (filename, comment, datetime) gets written to a SQLExpress database, and in a gridview a list of the files is shown. On the 7th of September I uploaded some files to my website, and it worked fine. In the database, the datetime-record shows "07/09/2006 11:45". When I try to upload a file today, it gives me the following error: Error: Arithmetic overflow error converting expression to data type datetime. The statement has been terminated.While searching in google, i found it might have something to do with the language settings of my SQLExpress, I've tried changing this, but it didn't help. What I find weird is that it worked fine, and now it doesn't anymore. Here is my code of how I get the current date to put it into the database:1 SqlDataSource2.InsertParameters.Add("DateInput", DateTime.Now.ToString());
Am I doing something wrong, or am I searching for a solution in the wrong place? best regards, Dimitri
View 3 Replies
View Related
Jan 7, 2008
Hi,
I'm having this error with my page, user picks the date -using the AJAX Control Toolkit Calender with the format of ( dd/MM/yyyy ).
It looks like the application current format is MM/dd/yyyy, because it shows the error page if the day is greater than 12, like: 25/03/2007
What is wrong?
Here is the error page:
Server Error in '/' Application.
Arithmetic overflow error converting expression to data type datetime.The statement has been terminated.
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: Arithmetic overflow error converting expression to data type datetime.The statement has been terminated.
Any help will be appreciated!
View 3 Replies
View Related
Jun 12, 2014
The following codes give me the error "arithmetic overflow error converting expression to data type datetime" Unfortunately, the datatype of date of this database is still varchar(50)
select date from tbltransaction
where datepart(wk,convert(datetime,date,103)) = 15
View 3 Replies
View Related
Feb 7, 2000
I have two tables which have dates in varchar fields on both. I have to
join them to get the data . I wrote the following syntax in where clause. In
one of the fields includes time and the other does not. But the thing is, I
got the Arithmetic overflow occurred error message after '01/01/2000'. Isn't
it strange?
convert(varchar(30),convert(datetime,R.request_dat e),101)=convert(varchar(30
),convert(datetime,B.request_date),101)
View 2 Replies
View Related
Mar 22, 2007
$exception {"Arithmetic overflow error converting expression to data type smalldatetime.
The statement has been terminated."} System.Exception {System.Data.SqlClient.SqlException}
occurs
here is my code
protected void EmailSubmitBtn_Click(object sender, EventArgs e)
{
SqlDataSource NewsletterSqlDataSource = new SqlDataSource();
NewsletterSqlDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["NewsletterConnectionString"].ToString();
//Text version
NewsletterSqlDataSource.InsertCommandType = SqlDataSourceCommandType.Text;
NewsletterSqlDataSource.InsertCommand = "INSERT INTO NewsLetter (EmailAddress, IPAddress, DateTimeStamp) VALUES (@EmailAddress, @IPAddress, @DateTimeStamp)";
//storeprocedure version
//NewsletterSqlDataSource.InsertCommandType = SqlDataSourceCommandType.StoredProcedure;
//NewsletterSqlDataSource.InsertCommand = "EmailInsert";
NewsletterSqlDataSource.InsertParameters.Add("EmailAddress", EmailTb.Text);
NewsletterSqlDataSource.InsertParameters.Add("IPAddress", Request.UserHostAddress.ToString());
NewsletterSqlDataSource.InsertParameters.Add("DateTimeStamp", DateTime.Now.ToString());
int rowsAffected = 0;
try
{
rowsAffected = NewsletterSqlDataSource.Insert();
}
catch (Exception ex)
{
Server.Transfer("NewsletterProblem.aspx");
}
finally
{
NewsletterSqlDataSource = null;
}
if (rowsAffected != 1)
{
Server.Transfer("NewsletterProblem.aspx");
}
else
{
Server.Transfer("NewsletterSuccess.aspx");
}
View 3 Replies
View Related
Jan 13, 2015
The following function is throwing the error:
1) "Arithmetic overflow error converting numeric to data type numeric."
2) The variable @x should only be set when if condition is equal to 1. For any other values, it should not go inside if condition. Does the following if condition code meet that criteria?
ALTER FUNCTION [dbo].[fn_Calculator]
(
@abc bit
)
returns decimal(14,10)
as begin
[code]...
View 3 Replies
View Related
Mar 28, 2008
insert into----
select ID_NO,cast(row_number() over(partition by ID_NO order by ID_NO)as varchar(2))
from
test_222
I am trying to insert into test222 table .The id_no column is varchar field
error:
Arithmetic overflow error converting expression to data type varchar.
The statement has been terminated.
View 7 Replies
View Related
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
Aug 28, 2002
l'm running this procedure and l get this error. All l'm trying to do is to get the size of the database and its objects and what the size should be so that its sized right. Is there a better way of doing this ?
CREATE PROCEDURE sp_totalsize as
SELECT o.name 'Table', SUM(c.length) 'Record size',
MAX (i.rows) '#of rows',
CONVERT (decimal (10, 4), SUM (c.length * i.rows)/(1024.00 * 1024.00)) 'Approx. size (MB)'
FROM sysobjects o, syscolumns c, sysindexes i
WHERE o.id = c.id
AND o.id = i.id
AND (i.indid = 1 or i.indid = 0)
AND o.type = 'U'
GROUP BY o.name
COMPUTE SUM (CONVERT (decimal (10,4), SUM (c.length * i.rows)/(1024.00 * 1024.00)))
GO
(17 row(s) affected)
Server: Msg 8115, Level 16, State 2, Procedure sp_totalsize, Line 3
Arithmetic overflow error converting expression to data type int.
View 1 Replies
View Related
Sep 27, 2004
Under certain circumstances I am getting the following error
"Arithmetic overflow error converting expression to data type int"
when running the following code:
SELECT Count(*), Sum(GrossWinAmount)
FROM LGSLog
WHERE
(CurrentDate >= '9/1/2004 8:00:00 AM') And (CurrentDate <= '9/27/2004 7:59:59 AM')
If I remove the "Sum(GrossWinAmount)" from the select, it works fine. I therefore believe that Sum is causing the error. Is there a version of Sum that works with larger variables, such as a BigInt? If not, is there some way to do the equivalent using larger numbers? I need to allow for the possibility of obtaining one month's summary, and sometimes the summary value is apparently too large for Sum to handle.
View 10 Replies
View Related
Sep 8, 2006
I've got this error message while generate the output with ASP:
"Microsoft OLE DB Provider for SQL Server (0x80004005)
Arithmetic overflow error converting expression to data type int."
it indicate that the error is related to this line:
"rc1.Movenext"
where rc1 is set as objconn.Execute(sql).
Not all outputs result like this, it happens when it has many relationships with other records, especially with those records which also have many relationships with other records.
Can anyone suggest a solution?
I've tried to increase the size of the database file, but it doesn't work.
View 4 Replies
View Related
Sep 4, 2012
This is the error in my query:
[Err] 22003 - [SQL Server] Arithmetic overflow error converting numeric to data type numeric.
If tried [%TAX] DECIMAL (10, 2) I have the correct output, but I need 4 decimal in my output.
Code:
MATNUMB-VER-EXENUMB-VER-RIC%TAX
a476427228.1515,17%
b9241314323.1515,50%
c7781510878.1413,98%
d7480019601.2626,20%
e877618297.099,45%
[Code] .....
View 2 Replies
View Related
Mar 25, 2015
In my sql statement, I don't have any datatype as INT, when I run it, give me error as 'Arithmetic overflow error converting expression to data type int'.
example :
select column1, 2, 3 .....
from (select sum(float) as column1 , ....)
When I hop my cursor on top of column1, it shows (int,null)
View 4 Replies
View Related
Jan 9, 2007
I am attempting to setup a replication from SQL Server 2005 that will be read by SQL Server Compact Edition (beta). I'm having trouble getting the Publication Wizard to create the Publication. Sample table definition that I'm replicating:
USE dbPSMAssist_Development;
CREATE TABLE corporations (
id NUMERIC(19,0) IDENTITY(1964,1) NOT NULL PRIMARY KEY,
idWas NUMERIC(19,0) DEFAULT 0,
logIsActive BIT DEFAULT 1,
vchNmCorp VARCHAR(75) NOT NULL,
vchStrtAddr1 VARCHAR(60) NOT NULL,
vchNmCity VARCHAR(50) NOT NULL,
vchNmState VARCHAR(2) NOT NULL,
vchPostalCode VARCHAR(10) NOT NULL,
vchPhnPrimary VARCHAR(16) NOT NULL,
);
CREATE INDEX ix_corporations_nm ON corporations(vchNmCorp, id);
GO
When the wizard gets to the step where it is creating the publication, I get the following error message:
Arithmetic overflow error converting expression to data type bigint. Changed database context to 'dbPSMAssist_Development'. (Microsoft SQL Server, Error: 8115).
I can find no information on what this error is or why I am receiving the error. Any ideas on how to fix would be appreciated.
Thanks in advance ...
David L. Collison
Any day above ground is a good day.
View 3 Replies
View Related
Oct 16, 2013
this query is running fine in 2008 , but its not working in 2005 below is the error Msg 8115, Level 16, State 2, Line 1 Arithmetic overflow error converting expression to data type int.there is some problem in converting date in cte
with aÂ
asÂ
(
SELECT dbname = DB_NAME(database_id) ,
    [DBSize] = CAST( ((SUM(ms.size)* 8) / 1024.0) AS DECIMAL(18,2) )Â
    ,
COALESCE(CONVERT(VARCHAR(12), MAX(bus.backup_finish_date), 101),'01/01/1900') AS LastBackUpTime
FROM Â sys.master_files ms
inner join msdb.dbo.backupset bus ON bus.database_name = DB_NAME()
[code]....
View 9 Replies
View Related
Aug 2, 2005
Hi all,
I have the following query...
SELECT Count(*)
FROM Incidents I
WHERE (Priority = 1)
AND (Time_First_Unit_On_Scene IS NOT NULL)
AND (DateDiff(s, Time_ClockStart, Time_First_Unit_On_Scene) <= 480)
AND (Response_Date BETWEEN '1-Apr-2004')
AND ('31-Mar-2005 23:59:59')
AND (I.Disposition_ID <> 9 )
...and I get the following error message...
System.Data.OleDb.OleDbException: Difference of two datetime columns caused overflow at runtime.
... any one know what it could be?
Thanks
Tryst
View 1 Replies
View Related
Mar 7, 2007
I thought I'd post this quick problem and answer, as I couldn't find the answer when searching for it.
I tried to call a stored procedure on SQL Server 2000 using the System.Data.SqlClient objects, and was not expecting any unusual issues. However when I came to call the Fill method I received the error "Arithmetic overflow error converting expression to data type int."
My first checks were the obvious ones of verifying that I'd provided all the correct datatypes and had no unexpected null values, but I found nothing out of order. The problem turns out to be a difference on the maximum values for integers between C# and SQL Server 2000. Previously having hit issues with SQL Server integers requiring Long Integer types in VB6, I was aware that these are 32-bit integers, so I was passing in Int32 variables. The problem was that Int32.MaxValue is not a valid integer for SQL Server. Seeing as I was providing an abitrary upper value for records-per-page (to fetch all in one page), I was simply able to change this to Int16.MaxValue and will hit no further problems as this is also well beyond any expected range for this parameter.
If anyone can name off the top of their heads what value should be provided as a maximum integer for SQL Server 2000, this might be a useful addition, but otherwise I hope this spares others some hunting if they also experience this problem.
James Burton
View 1 Replies
View Related
Sep 23, 2005
At my job is a dts package that is failing in SQL 2005. I am not a SQLexpert. I am just trying to fix. I put the query in Query Analyzerand get this error:(4322 row(s) affected)Server: Msg 535, Level 16, State 1, Line 1Difference of two datetime columns caused overflow at runtime.I am just trying to understand what this means, what I should belooking for and what could be wrong. Here is the query:SELECT i.SerialNumber, '' AS mac_number, DATEDIFF([second], 'Jan 1,1970', s.DateOrdered) AS Support_StartDt, DATEDIFF([second], 'Jan 1,1970',s.Warranty_Enddate) AS Support_EndDt,DATEDIFF([second], 'Jan 1, 1970', c.Registration_Date) ASRegistration_Date, c.FirstName AS enduser_fname,c.LastName AS enduser_lname, c.CompanyName ASenduser_companyname, c.ContactEmail AS enduser_email, c.Address ASenduser_address1,c.Address2 AS enduser_address2, c.City ASenduser_city, c.State AS enduser_state, c.Zip AS enduser_zip,c.WorkPhone AS enduser_phone,c.Fax AS enduser_fax, d.DealerName ASdealer_companyname, d.ContactFirstName AS dealer_fname,d.ContactLastName AS dealer_name,d.Address1 AS dealer_address, d.City ASdealer_city, d.State AS dealer_state, d.Zip AS dealer_zip,d.ContactPhone AS dealer_phone,d.ContactFax AS dealer_fax,ISNULL(SUBSTRING(p.ProductName, 11, LEN(p.ProductName) - 10), 'unknownIWP product') AS product_type, '' AS extra1,'' AS extra2, '' AS extra3, '' AS extra4, '' ASextra5, '' AS extra6, '' AS extra7FROM tblInventory i full outer JOINtblDealers d ON i.DealerID = d.DealerID fullOUTER JOINtblSupport s ON i.InventoryID = s.InventoryIDfull outer JOINtblCustomers c ON s.InventoryID = c.InventoryIDLEFT OUTER JOINtblProducts p ON LEFT(i.SerialNumber,PATINDEX('%-%', i.SerialNumber)) = p.SerialPrefixWHERE i.SerialNumber <> ''Any ideas would be greatly appreciated.
View 2 Replies
View Related
Oct 13, 2012
When I run the following sql query:
"update table set price = price * 1.1 "..
I get the following error : "Msg 8115, Level 16, State 8, Line 1.. Arithmetic overflow error converting nvarchar to data type numeric. The statement has been terminated."
The table is set to nvarchar, and i am just trying to make the prices go up 10%.
View 9 Replies
View Related
Oct 30, 2014
OK, so I have this query where I'm trying to subtract values like this, when I do this I am getting (Arithmetic overflow error converting varchar to data type numeric.) I have tried many different things, and now of these work, it'll either return 0 because it loses the .XXXXX.
Convert(DECIMAL(10,7),CAST([TIME_OF_COMPLETION] as DECIMAL(10,7)) - Convert(DECIMAL(10,7),CAST([OPR_DELIVERED_TIME] as DECIMAL(10,7)) round(cast(cast(hist.[TIME_OF_COMPLETION] AS float) as DECIMAL(15, 5)) - CAST(hist.[OPR_DELIVERED_TIME] AS FLOAT),1 SELECT convert(FLOAT,CAST('735509.00053' AS DECIMAL(10,5))) - convert(FLOAT,CAST('735509.00047' AS DECIMAL(10,5)))
View 1 Replies
View Related
Apr 3, 2014
I am trying to setup an indicator value for an SSRS report to show green and red values on a report, based on the NRESULT value. The problem I am facing is that I have several different CASE statements that have the same logic, and they are processing just fine. NRESULT is a decimal field, so no conversion should be necessary. I do not know why I am getting the "Arithmetic overflow error converting varchar to data type numeric." error message.
Below is the CASE statement where the error is occurring. It is in the part of the ELSE CASE. The first CASE works just fine when the ELSE CASE is commented out. If I also change the ELSE CASE statement to say "else case when LEFT(NRESULT,1) = '-' then '0'", then it processes fine, too, so it has to be something I am missing something in the check on negative values. I do need the two checks, one for positive and one for negative values, to take place.
case when LEFT(NRESULT,1) <> '-' then --This portion, for checking positive values, of the CASE statement works fine.
CASE WHEN LEFT(ROUND(NRESULT,2),4) between 0.00 and 0.49 THEN '2' --Green
ELSE CASE WHEN LEFT(ROUND(NRESULT,2),4) > 0.49 THEN '0' --Red
ELSE '3' --White
END
END
else case when LEFT(NRESULT,1) = '-' then --This portion, for checking negative values, of the CASE statement is producing the conversion error message.
[code]....
I checked the NRESULT field, and there are not any NULL values in there, either.
View 1 Replies
View Related
Sep 10, 2001
When I try to run the query..it goes well..but says
Arithmetic overflow occurred.
at the end of the records..
What does that means..?
View 1 Replies
View Related
Nov 24, 1999
Ok I'm doing a simple insert query:
insert into product(CategoryID, StoreID, MallCategoryID, ProductName, Manufacturer, ProductItemNumber, Size, Color, SizeApplies, ColorApplies, Price, Discontinued, ProductDescription, GiftWrapping, Gender, Age, MinAge, MaxAge, Tax, Shipping)
values(100, 100, 80, 'test product Casdfasdf', 'test manufacturer', 'est', '', '', 0, 0, 99.95, 0, 'test desc', 0, 'Both', '', '0', '0', 0, 0)
I get this error:
Arithmetic overflow occurred.
It dosn't make sense that this would happen because the number fields are not huge at all.
Any ideas...?
here's the table layout:
CREATE TABLE dbo.Product (
ProductID smallint IDENTITY (1, 1) NOT NULL ,
ProductName varchar (100) NULL ,
Gender varchar (10) NULL ,
ProductDescription varchar (255) NULL ,
Manufacturer varchar (75) NULL ,
ProductItemNumber varchar (50) NULL ,
Tax bit NOT NULL ,
Shipping bit NOT NULL ,
ApproxWeight varchar (10) NULL ,
MallCategoryID smallint NULL ,
GiftWrapping bit NOT NULL ,
ShippingCost decimal(18, 2) NULL ,
GiftWrappingCost decimal(18, 2) NULL ,
ImageName varchar (25) NULL ,
Price decimal(18, 2) NULL ,
SizeApplies bit NOT NULL ,
ColorApplies bit NOT NULL ,
Age varchar (20) NULL ,
StoreID smallint NULL ,
CategoryID smallint NULL ,
Discontinued bit NOT NULL ,
MinAge varchar (5) NULL ,
MaxAge varchar (5) NULL ,
Size text NULL ,
Color text NULL
)
THANKS!!!!
View 2 Replies
View Related
Apr 6, 1999
hi, I am running a procedure, got this error:
Arithmetic overflow occurred. (Message 3606)
the procedure failed.
Can anyone tell me why this error occured,and how to solve it so I can have the process results.
Thanks
Ali
View 1 Replies
View Related
Jun 10, 2014
when I run below query I got Error of Arithmetic overflow error converting numeric to data type numeric
declare @a numeric(16,4)
set @a=99362600999900.0000
The 99362600999900 value before numeric is 14 and variable that i declared is of 16 length. Then why this error is coming ? When I set Length 18 then error removed.
View 2 Replies
View Related
Jul 24, 2015
When I execute the below stored procedure I get the error that "Arithmetic overflow error converting expression to data type int".
USE [FileSharing]
GO
/****** Object: StoredProcedure [dbo].[xlaAFSsp_reports] Script Date: 24.07.2015 17:04:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
[Code] .....
Msg 8115, Level 16, State 2, Procedure xlaAFSsp_reports, Line 25
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
(1 row(s) affected)
View 10 Replies
View Related
Mar 21, 2006
Guys
I'm getting the above when trying to populate a variable. The values in question are :
@N = 21
@SumXY = -1303765191530058.2251000000
@SumXSumY = -5338556963168643.7875000000
When I run, SELECT (@N * @SumXY) - (@SumXSumY * @SumXSumY) in QA I get the result OK which is -28500190448996439680147097583285.072256 ie 32 places to left of decimal and 6 to the right
When I try the following ie to populate a variable with that value I get the error -
SELECT R2Top = (@N * @SumXY) - (@SumXSumY * @SumXSumY)@R2Top is NUMERIC (38, 10)
Any ideas ??
View 6 Replies
View Related
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
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
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
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