Index Creation Causes Error The Conversion Of A Char Data Type To A Datetime Data Type Resulted...
Jul 23, 2005
Hi all,
I have a table called PTRANS with few columns (see create script below).
I have created a view on top that this table VwTransaction (See below)
I can now run this query without a problem:
select * from dbo.VwTransaction
where
AssetNumber = '101001' and
TransactionDate <= '7/1/2003'
But when I create an index on the PTRANS table using the command below:
CREATE INDEX IDX_PTRANS_CHL# ON PTRANS(CHL#)
The same query that ran fine before, fails with the error:
Server: Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
I can run the same query by commeting out the AssetNumber clause and it
works fine. I can also run the query commenting out the TransactionDate
column and it works fine. But when I have both the conditions in the
WHERE clause, it gives me this error. Dropping the index solves the
problem.
Can anyone tell me why an index would cause a query to fail?
Thanks a lot in advance,
Amir
CREATE TABLE [PTRANS] (
[CHL#] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CHCENT] [numeric](2, 0) NOT NULL ,
[CHYYMM] [numeric](4, 0) NOT NULL ,
[CHDAY] [numeric](2, 0) NOT NULL ,
[CHTC] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
CREATE VIEW dbo.vwTransactions
AS
SELECT CONVERT(datetime, dbo.udf_AddDashes(REPLICATE('0', 2 -
LEN(CHCENT)) + CONVERT(varchar, CHCENT) + REPLICATE('0', 4 -
LEN(CHYYMM))
+ CONVERT(varchar, CHYYMM) + REPLICATE('0', 2 -
LEN(CHDAY)) + CONVERT(varchar, CHDAY)), 20) AS TransactionDate,
CHL# AS AssetNumber,
CHTC AS TransactionCode
FROM dbo.PTRANS
WHERE (CHCENT <> 0) AND (CHTC <> 'RA')
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
View 1 Replies
ADVERTISEMENT
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
Dec 14, 2005
After testing out the application i write on the local pc. I deploy it to the webserver to test it out. I get this error.
System.Data.SqlClient.SqlException: The conversion of a char data type to a
datetime data type resulted in an out-of-range datetime value.
Notes: all pages that have this error either has a repeater or datagrid which load data when page loading.
At first I thought the problem is with the date, but then I can see
that some other pages that has datagrid ( that has a date field) work
just fine.
anyone having this problem before?? hopefully you guys can help.
Thanks,
View 4 Replies
View Related
Apr 19, 2008
Advance thanks ....... My table is TimeSheet:----------------------------------- CREATE TABLE [dbo].[TimeSheet]( [autoid] [int] IDENTITY(1,1) NOT NULL, [UserId] [int] NOT NULL, [starttime] [datetime] NOT NULL, [endtime] [datetime] NOT NULL, [summary] [nvarchar](50) NOT NULL, [description] [nvarchar](50) NULL, [dtOfEntry] [datetime] NOT NULL, [Cancelled] [bit] NULL) ON [PRIMARY] My Query is------------------ insert into timesheet (UserId, StartTime,EndTime, Summary, Description,DtOfEntry) values (2, '19/04/2008 2:05:06 PM', '19/04/2008 2:05:06 PM', '66', '6666','19/04/2008 2:05:06 PM')i m not able to insert value Error Message is-------------------------Msg 242, Level 16, State 3, Line 1The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated. can any body give any solution
View 5 Replies
View Related
Aug 3, 2005
Hey, I have a big problem that i wanna search data from SQL by DateTime like thatselect * from test where recorddate='MyVariableWhichHoldDate'i use variable that holds Date info.i searched a lot infomation on net but there is no perfect solution. i know why this occur but there is no function to solve this problem. i used a lot of ways. it accept yyyy-mm-dd format but my variable format is dd-mm-yyyyy . is there any function for this problem? and any other solution.thanks for ur attentionregards
View 6 Replies
View Related
Mar 30, 2007
I am using Visual Studio 2005 and SQL Express 2005. The database was converted from MS Access 2003 to SQL Express by using the upsize wizard.
I would like to store the current date & time in a column in a table. This column is a smalldatetime column called 'lastlogin'.
The code I'm using is:
Dim sqlcommand As New SqlCommand _
("UPDATE tableXYZ SET Loggedin = 'True', LastLogin = GetDate() WHERE employeeID = '" & intEmployeeID.ToString & "'", conn)
Try
conn.Open()
sqlcommand.ExecuteNonQuery()
conn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
This code works fine on my local machine and local SQL server. However at the client side this code results in the error as mentioned in the subject of this thread. I first used 'datetime.now' instead of 'getdate()', but that caused the same error. Then I changed the code to 'getdate()', but the error still remains.
The server at the client is running Windows Server 2000 UK . My local machiine is running WIndows XP Dutch.
Maybe the conversion from Dutch to UK has something to do with it. But this should be solved by using the 'Getdate()' function..... ?
View 1 Replies
View Related
May 13, 2008
hello all .. I have a form that includes two textboxes (Date and Version) .. When I try to insert the record I get the following error message .. seems that something wrong with my coversion (Data type)"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."
in my SQL database I have the date feild as datetime and the version as nvarchar(max)
this is the code in the vb page .. Can you please tell me how to solve this problem?Imports System.Data.SqlClient
Imports system.web.configuration
Partial Class Admin_emag_insert
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Record_DateTextBox.Text = DateTime.Now
End Sub
Protected Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
Me.VersionTextBox.Text = ""
End Sub
Protected Sub addButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles addButton.Click
Dim objConnection As SqlConnection
Dim objDataCommand As SqlCommand
Dim ConnectionString As String
Dim record_date As Date
Dim version As String
Dim emagSQL As String
'save form values in variables
record_date = Record_DateTextBox.Text
version = VersionTextBox.Text
ConnectionString = WebConfigurationManager.ConnectionStrings("HRDBConnectionString").ConnectionString
'Create and open the connection
objConnection = New SqlConnection(ConnectionString)
objConnection.Open()
emagSQL = "Insert into E_Magazine (Record_Date, Version ) " & _
"values('" & record_date & "','" & version & "')"
'Create and execute the command
objDataCommand = New SqlCommand(emagSQL, objConnection)
objDataCommand.ExecuteNonQuery()
objConnection.Close()
AddMessage.Text = "A new emagazine was added successfully"
Me.VersionTextBox.Text = ""
End Sub
End Class
View 10 Replies
View Related
May 14, 2015
I have problem to execute query with interval date.
If try this query I don't have problem and the output is correct:
SELECT * FROM dotable
WHERE
dotableDate BETWEEN CONVERT (datetime, '01/01/2015', 121)
AND CONVERT (datetime, '09/01/2015', 121);Instead if try this I have error:
SELECT * FROM dotable
WHERE
dotableDate BETWEEN CONVERT (datetime, '25/01/2015', 121)
AND CONVERT (datetime, '28/01/2015', 121);
[Err] 22007 - [SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
View 3 Replies
View Related
May 13, 2006
Hi,
I have a column of type datetime in sqlserver 2000. Whenever I try to insert the date
'31/08/2006 23:28:59'
I get the error "...datetime data type resulted in an out-of-range datetime value"
I've looked everywhere and I can't solve the problem. Please note, I first got this error from an asp.net page and in order to ensure that it wasn't some problem with culture settings I decided to run the query straight in Sql Query Anaylser. The results were the same. What else could it be?
cheers,
Ernest
View 2 Replies
View Related
Sep 11, 2006
im trying to convert char (18) data type to decimal (18,6) but it wont let me do it. It gives an arithematic error. what would be other way to solve this problem. Can i do it with float if yes how so? or any other suggested way. Thanks
View 6 Replies
View Related
Jul 12, 2000
I would like to know how to translate a numeric value = 3 to a text or char value = 03.
Any input would be appreciated.
Thanks,
Joel
View 1 Replies
View Related
Mar 2, 2007
Thanks in adance
Platform: SQL 2000
A SQL table has a field named "pay-day" with Char(8) data type.
I tried to change its data type to datetime but only with an error message like this. I did right-click the table and tried to modify a data type.
- Unable to modify table.
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.
Jay
View 4 Replies
View Related
Apr 25, 2005
Here is the situation...
I am using SQL Server 2000. I have created a Store Procedure to
insert information, 4 of the fields are date types. I am using
OleDb Data Provider (System.Data.OleDb) namespace.
The dates are filled by a form (web form) on submit event, I created a
class that has functions to create my OleDb Parameters. I add the
parameters to the command and execute it through a SQL Server Stored
Procedure. In the event that I must have coded something wrong, I
tested in the SQL Query Analyzer and the IN parameters for the date I
used the getDate() method. This is where I know it is OleDb and
SQL Server Parameters.
What Converstion Format should I use in the SP for the date?
OleDb.date are doubles from some date in 1979 or something or
another. So I used an OleDbDataType.DBDate. It seems that
when the Stored Procedure uses the IN Parameters dates provided by
OleDbDataType.Date or DBDate, that it doesn't like the int
format. I am guessing that I am not converting the date in the
parameters in the Insert of the Store Procedure... this is basically
what I have...
Function to add parameters and execute SP
private int _startdate = DateTime.Now;
private int _finishdate = DateTime.Now.AddDays(30);
OleDbParameter[] myParams = {
ParamBuilder("@StarDate", OleDbType.DBDate, 8, _startdate),
ParamBuilder("@FinishDate", OleDbType.DBDate, 8, _finishdate)
};
ExecuteNonQuery("myInsert", myParams);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CREATE PROCEDURE myInsert
@StartDate datetime, @FinishDate datetime AS
INSERT INTO myTable (STARTDATE, FINISHDATE)
VALUES (Convert(datetime, @StartDate), Convert(datetime, @FinishDate))
Please keep in mind that I am using System.Data.OleDb
namespace..... please don't tell me to use SQLClient, it seems
since I've been so adaptive of using OleDb, that it sould work just as
well. I am way too far into this to change my Provider to SQL
Client, but I promise myself that the next project (if using SQL
Server, I will be using SQLClient and I will keep using OleDb for
Oracle.) *sigh*
Help!
View 1 Replies
View Related
Mar 18, 2014
I have code below not working in SQL 2012
declare @d1, @d2, @d3 datetime
...where @d1 between (@d2-15) and (@d3 + 15)
Error:
Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query...
View 2 Replies
View Related
Mar 26, 2008
Hey im trying to store a category name and the date into a database. For some reason i keep getting this error
Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.
This error is the error im getting back from the database. the datetime field in the database is a datatype (DateTime) so what exactly is going on ?protected void InsertNewCat_Click(object sender, EventArgs e)
{ string insertSql = "INSERT into Category (CategoryName,Date) VALUES (@Category, @Date)";
string conString = WebConfigurationManager.ConnectionStrings["ProCo"].ConnectionString; SqlConnection con = new SqlConnection(conString);
SqlCommand cmd = new SqlCommand(insertSql, con); cmd.Parameters.AddWithValue("@Category", NewCat.Text);
cmd.Parameters.AddWithValue("@Date",DateTime.Now);
try
{
con.Open(); int update = cmd.ExecuteNonQuery(); CatInsertStatus.Text = update.ToString() + " record updated.";
}catch (Exception Err)
{
CatInsertStatus.Text = Err.Message;
}
finally
{
con.Close();
}
}
View 9 Replies
View Related
Jul 6, 2006
I am trying to use the Bulk Insert Task to load from a csv file. My final column is a bit that is nullable. My file is an ID column that is int, a date column that is mm/dd/yyy, then 20 columns that are real, and a final column that is bit. I've tried various combinations of codepage and datafiletype on my task component. When I have RAW with Char, I get the error included below. If I change to RAW/Native or codepage 1252, I don't have an issue with the bit; however, errors start generating on the ID and date columns.
I have tried various data type settings on my flat file connection, too. I have tried DT_BOOL and the integer datatypes. Nothing seems to work.
I hope someone can help me work through this.
Thanks in advance,
SK
SSIS package "Package3.dtsx" starting.
Error: 0xC002F304 at Bulk Insert Task, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 24. Verify that the field terminator and row terminator are specified correctly.Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 23 (cancelled).".
Error: 0xC002F304 at Bulk Insert Task 1, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 24. Verify that the field terminator and row terminator are specified correctly.Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 23 (cancelled).".
Task failed: Bulk Insert Task 1
Task failed: Bulk Insert Task
Warning: 0x80019002 at Package3: The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "Package3.dtsx" finished: Failure.
View 5 Replies
View Related
Nov 6, 2007
Hi,I keep getting the error:System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value '@qty' to data type int. When I initiate the insert and update.I tried adding a: Convert.ToInt32(TextBox1.Text), but it didn't work.. Could someone help?My code:private bool ExecuteUpdate(int quantity){ SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"; con.Open(); SqlCommand command = new SqlCommand(); command.Connection = con; TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1"); Label labname = (Label)FormView1.FindControl("Label3"); Label labid = (Label)FormView1.FindControl("Label13"); command.CommandText = "UPDATE Items SET Quantityavailable = Quantityavailable - '@qty' WHERE productID=@productID"; command.Parameters.Add("@qty", TextBox1.Text); command.Parameters.Add("@productID", labid.Text); command.ExecuteNonQuery(); con.Close(); return true;} private bool ExecuteInsert(String quantity) { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"; con.Open(); SqlCommand command = new SqlCommand(); command.Connection = con; TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1"); Label labname = (Label)FormView1.FindControl("Label3"); Label labid = (Label)FormView1.FindControl("Label13"); command.CommandText = "INSERT INTO Transactions (Usersname,Itemid,itemname,Date,Qty) VALUES (@User,@productID,@Itemsname,@date,@qty)"; command.Parameters.Add("@User", System.Web.HttpContext.Current.User.Identity.Name); command.Parameters.Add("@Itemsname", labname.Text); command.Parameters.Add("@productID", labid.Text); command.Parameters.Add("@qty", Convert.ToInt32(TextBox1.Text)); command.Parameters.Add("@date", DateTime.Now.ToString()); command.ExecuteNonQuery(); con.Close(); return true; }protected void Button2_Click(object sender, EventArgs e){ TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox; ExecuteUpdate(Int32.Parse(TextBox1.Text) );}protected void Button2_Command(object sender, CommandEventArgs e) { if (e.CommandName == "Update") { TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox; ExecuteInsert(TextBox1.Text); } } Thanks so much if someone can!Jon
View 33 Replies
View Related
Jun 21, 2001
I'm trying to convert a column from a varchar(14) to float, some of the rows contain some non-numeric characters. I've tried to write a cursor to step through the records, run cast(col1 as float) on each record, then use if @@error <> 0 to capture an error but it doesn't work. It steps through fine but when the cast command fails it ends the execution of the script with "Error converting data type varchar to float."
How can i capture this error without having the script fail? Is there another way to get this done?
Thanks,
Jim
View 1 Replies
View Related
Jun 22, 2006
Dear friends,
I am struggling to insert a date value in "dd-mm-yyyy" format to SQL server table having datatype as Date/Time.
Regional date setting for Server and Local systems are in dd-mm-yyyy format.
I am using following code
Dim DT As String
DT = Now()
DT = Format(DT, "MM/DD/YYYY")
for the inserting into table using command
ins_comm.CommandText = " INSERT INTO CARD (doe) values("& DT &")"
Procedure will end without any error ,but stored value for the date feild will be garbage value like 1900-01-01.
But if i used mm-dd-yyyy format ,it will get inserted.
What could be the reason,How I can save value in dd-mm-yyyy or dd-mm-yy format
Please help!!!
Graceson Mathew
View 1 Replies
View Related
Jan 19, 2007
Hi,
I can't seem to fix the following error in my stored procedure.
Error Message: Conversion failed when converting the nvarchar value '1007-001' to data type int.
The line of code in my stored procedure that seems to be the problem is the following:
CASE WHEN [Order Details].[Job No] IS NULL THEN [Orders].[Order No] ELSE [Order Details].[Job No] END
Order No has a data type of INT and Job No has a data type NVARCHAR(8). In the above case statement i'm not trying to convert anything but just display a column depending on the out come of the case statement. If anyone knows how to get around this error you help would be very welcome.
View 2 Replies
View Related
Feb 16, 2007
Hi,
It is not exactly what I stated in the subject - It's an outcome - exception thrown while executing non-query command.
I get this exception when I try to execute my stored procedure that takes datetime as one of its parameters.
I am using dataset designer to create table adapters and build queries. Then I simply use objectdatasource component that uses one of the table adapters and bind it to for example a detailsview control.
When I run this in debug mode and trace the objects everything looks perfect including these datetime parameters. It is sql server that throws the exception. I ran the sql profiler to see what exactly is going on, and I captured the command that is sent by ADO - it's broken into several lines right in the middle of my datetime parameters... this is the source of the problem. Everything is working fine when I take this command and execute it as a single line in the sql management studio.
Is there anything about ADO that I do not know?
View 2 Replies
View Related
Mar 23, 2006
Hi
I have an insert stored procedure with a parameter @eventDate date type date time. I have written a web form that takes the textbox.text value and assigns to the @eventDate parameter using a querystring. Howevr when I run the application I get a SQL Exception error converting data type nvarchar to datetime.
I have tried dssqlInsertEvent.InsertParameters.add("EventDate", convert.todatetime(txtEventDate.text)); wbut received another error.
Any assistance would be greatly appreciated.
View 4 Replies
View Related
Jul 7, 2004
I'm getting the error Error converting data type DBTYPE_DBTIMESTAMP to datetime when I try to import a date field from Oracle to SQL Server.
SELECT CAST(cancel_dt as datetime) FROM OPENQUERY(orcldb, 'SELECT cancel_dt FROM tablename WHERE id= 12345')
The date in Oracle is 19-JUN-99, but it's coming over as 06/19/0999 and it throws the error because the year 999 is invalid in SQL Server. Any ideas on why Oracle or SQL server would convert the year to 0999 instead of 1999?
This is also happening on a value 24-SEP-07 coming over as 09/24/0207
Most other date values work, so I'd really like to get in depth into the process that occurs when converting to a SQL Server datetime.
View 7 Replies
View Related
Dec 4, 2004
hi
i want to pass a datetime variable from a asp page to MSSQL through a stored procedure, & i get this error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to datetime.
this is the code that i use in page:
strsql="sp_inventory @timee=' " & RecievedDate & " ' "
also i use this one:
but i still get this error
strsql="sp_inventory @timee=' " & cdate(RecievedDate) & " ' "
this is maybe useful that i get this errot on some PCs, not all the computeres.
sometimes work well, & sth not work.
View 2 Replies
View Related
Dec 22, 2004
Here is the stored procedure
the data type for the column b_trn_tentdte is decimal(8,0).
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER Procedure Prc_New_cus_wo_prev_posted
@b_trn_tendte_Beg_Date datetime
,@b_trn_tendte_End_Date datetime
@b_trn_tendte_Beg_Date1 datetime
,@b_trn_tendte_End_Date2 datetime
as
declare @Beg_tentdte datetime
declare @End_tentdte datetime
declare @Beg_tentdte1 datetime
declare @Beg_tentdte2 datetime
set @Beg_tentdte = convert(varchar(10), @b_trn_tendte_Beg_Date, 112)
set @End_tentdte = convert(varchar(10), @b_trn_tendte_End_Date, 112)
set @Beg_tentdte1 = convert(varchar(10), @b_trn_tendte_Beg_Date1, 112)
set @Beg_tentdte2 = convert(varchar(10), @b_trn_tendte_End_Date2, 112)
/* this query looks for customers with posted
transactions but none prior to the date range
in question */
Select distinct b_cus_cname
from
bar_cus_db_rec
,bar_trn_db_rec b
where b.b_trn_instid = ''
and b.b_trn_instid = b_cus_instid
and b.b_trn_actid = b_cus_cusid
and convert(varchar(10), b.b_trn_tentdte) between @Beg_tentdte and @End_tentdte
and not exists (select c.b_trn_actid
from bar_trn_db_rec c
where c.b_trn_instid = b.b_trn_instid
--and c.b_trn_tentdte between 19970901 and 20030229
and convert(varchar(10), c.b_trn_tentdte) between @Beg_tentdte1 and @Beg_tentdte2
and c.b_trn_actid = b.b_trn_actid)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
every time I run the query, I get this error message:
Error converting data type varchar to datetime.
thanks for your assistance.
View 5 Replies
View Related
Jun 21, 2006
An application i am using creates an error.
Using SQL-profiler i catch this statement:
exec sp_executesql N'insert into RECORDING_SCHEDULE (programme_oid, capture_source_oid, filename, status, recording_group, recording_type, manual_channel_oid,
manual_start_time, manual_end_time, quality_level, pre_pad_minutes, post_pad_minutes) values (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10,@P11,@P1 2)',N'@P1 int,@P2 int,@P3
nvarchar(19),@P4 int,@P5 int,@P6 int,@P7 int,@P8 datetime,@P9 datetime,@P10 int,@P11 int,@P12 int',177748,2,N'Lilla röda traktorn',4,40,5,16,''2006-06-21
17:00:00:000'',''2006-06-21 20:00:00:000'',1,1,2
After removing the double ' around the date and time parts i get the following error when running in QA:
Msg 8114, Level 16, State 5, Line 0
Error converting data type varchar to datetime.
If a remove the time portion it works.
The DDL for the table is:
CREATE TABLE [dbo].[RECORDING_SCHEDULE](
[oid] [int] IDENTITY(1,1) NOT NULL,
[programme_oid] [int] NULL,
[capture_source_oid] [int] NULL,
[status] [smallint] NOT NULL,
[filename] [varchar](255) NULL,
[recording_type] [int] NULL,
[recording_group] [int] NULL,
[manual_start_time] [datetime] NULL,
[manual_end_time] [datetime] NULL,
[manual_channel_oid] [int] NULL,
[quality_level] [int] NULL CONSTRAINT [DF__RECORDING__quali__38996AB5] DEFAULT ((0)),
[pre_pad_minutes] [int] NULL CONSTRAINT [DF__RECORDING__pre_p__398D8EEE] DEFAULT ((0)),
[post_pad_minutes] [int] NULL CONSTRAINT [DF__RECORDING__post___3A81B327] DEFAULT ((0)),
CONSTRAINT [aaaaaRECORDING_SCHEDULE_PK] PRIMARY KEY NONCLUSTERED
What am I missing?
View 2 Replies
View Related
May 4, 2006
Hi
I am trying to transfer data from Access 2000 database to SQL server 2005 via SSIS. My access database table has a field with data type Date/Time and SQL server table has a field with data type datetime. When I am running the SSIS package, it is throwing the following error and stops execution.
[SQL Server Destination [12466]] Error: An OLE DB error has occurred. Error code: 0x80040E07. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80040E07 Description: "Error converting data type DBTYPE_DBTIMESTAMP to datetime.".
Please help.
Thanks in advance,
Ramzee
View 12 Replies
View Related
Apr 22, 2007
Hi
I am trying to migrate data from oracle to sql server 2005 in sql server management studio express, most of my data in oracle have been successfully moved into sql server 2005 by using storage procedure. But some of data can't move across becasue i got this error:
Error converting data type DBTYPE_DBTIMESTAMP to datetime
Does anyone know why? Please help?
Thanks
Li
View 1 Replies
View Related
Jun 2, 2008
Hi,
I'm pretty desperat after trying solving the above problem in several days. I hope somone here can help me :-)
I have this stored procedure. When I try to Execute the storedprocedure where I have a date as parameter I get the above error.
I checked (many times), that the input parameter is a datetime format (30-05-2008) and also I checked the tabel and it is datetime format. I checked the table to see if it was english datetime format - but all the datetimes that are listet are listed in danish datetime format DD-MM-YYYY.
In the stored procedure I try this:
fProjectSkuTimeStamp >= @ReducedTime
I can't figure out where it gets that nvarchar from?
My stored procedure look like this:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
set NOCOUNT ON
go
ALTER PROCEDURE [dbo].[GetProjectSkuList]
@fProjectFId AS INTEGER = null, --ProjektId
@ReducedTime AS DATETIME --Tidsrum fra
AS
BEGIN
SELECT tProjectSku.fProjectSkuPId, tProjectSku.fCompanyFId, tProjectSku.fProjectFId,
tProjectSku.fProjectSkuDate,
tProjectSku.fOurContactFId, tProjectSku.fOurContactF2Id, tProjectSku.fOrderFId,
tProjectSku.fProjectSkuTimeStamp,
tProjectSku.fProjectSkuNote1, tProjectSku.fProjectSkuNote2, tProjectSku.fContactFId,
tProjectSku.fStoreTransactionsFId,
tProjectSku.fProjectSkuSalesPrice, tCompany.fCompanyName, tProject.fProjectName,
tOurContact.fOurContactFirstName + ' ' + tOurContact.fOurContactLastName AS CreatedBy,
tOurContact_1.fOurContactFirstName + ' ' + tOurContact_1.fOurContactLastName AS Responsible,
tContact.fContactFirstName + ' ' + tContact.fContactLastName AS ContactFullName,
tStoreTransactions.fStoreTransactionsCostPrice,
tStoreTransactions.fStoreTransactionsSerialNo
FROM tOurContact AS tOurContact_1 RIGHT OUTER JOIN
tContact RIGHT OUTER JOIN
tProjectSku LEFT OUTER JOIN
tStoreTransactions ON tProjectSku.fStoreTransactionsFId = tStoreTransactions.fStoreTransactionsPId ON
tContact.fContactPId = tProjectSku.fContactFId LEFT OUTER JOIN
tOrder ON tProjectSku.fOrderFId = tOrder.fOrderPId ON tOurContact_1.fOurContactPId = tProjectSku.fOurContactF2Id LEFT OUTER JOIN
tOurContact ON tProjectSku.fOurContactFId = tOurContact.fOurContactPId LEFT OUTER JOIN
tProject ON tProjectSku.fProjectFId = tProject.fProjectPId LEFT OUTER JOIN
tCompany ON tProjectSku.fCompanyFId = tCompany.fCompanyPId
WHERE
(tProjectSku.fProjectFId = @fProjectFId) AND
--fProjectSkuTimeStamp >= CONVERT(datetime, @ReducedTime, 120)
fProjectSkuTimeStamp >= @ReducedTime
ORDER BY tProjectSku.fProjectSkuPId DESC
END
Kind regards,
simsen :-)
View 7 Replies
View Related
Nov 17, 2006
Hi,
I am trying to setup Trans Replication with updating subscriber on sql2000. One column on few tables got data with single quote (').
How do I handle in this case? Did any one come across such case?
Can I Change default QUOTED IDENTIFIER from ' (single quote) to something else (@@@) on SQL2000?
If yes, how to do?
Thanks
mka
View 1 Replies
View Related
Sep 27, 2004
Hi,
Iam trying to import data from a csv file into my table in SQL Server 2000. My table is called as temp_table and consists of 3 fields.
column datatype
-------- -----------
program nvarchar(20)
description nvarchar(50)
pId int
pId has been set to primary key with auto_increment.
My csv file has 2 columns of data and it looks like follows:
program, description
"prog1", "this is program1"
"prog2", "this is program2"
"prog3", "this is program3"
Now i use BULK INSERT like this
"BULK INSERT ord_programs FROM 'C:datafile.csv' WITH (FIELDTERMINATOR=',', ROWTERMINATOR='', FIRSTROW=2)"
to import data into my table in SQL server and it gives me this error
"Bulk insert data conversion error (type mismatch) for row 2, column 3 (pId)"
I guess i have to use fileformat or something since i dont have anything for pId field in the csv file to make it work...
Please help me out guys and please post a snippet of code if you have.
Thank You.
View 2 Replies
View Related
Aug 24, 2007
ALTER procedure [dbo].[findConsultantMail]
(
@PerID numeric(18,0),
@perMail nvarchar(100) OUTPUT
)
as
SELECT @perMail=PerMail FROM Personel
WHERE (PerID =@PerID)
return @perMail
I want to get Email address from sql database.
But whenever I executed stored procedure I get an error message
"Conversion failed when converting the nvarchar value 'xxxxxx@xxxxxx' to data type int"
If I want some numeric ID it is worked.
I also change my SP like this but results same.
ALTER procedure [dbo].[findConsultantMail]
(
@PerID nvarchar(18),
@perMail nvarchar(100) OUTPUT
)
as
SELECT @perMail=PerMail FROM Personel
WHERE (PerID =cast(@PerID as numeric(18,0)))
return cast(@perMail as nvarchar(100))
How can I get a string value form stored procedure.
View 4 Replies
View Related
Oct 13, 2006
Hi,
I am havin problems with the following giving a message
Msg 8114, Level 16, State 4, Line 0
Error converting data type varchar to datetime.
exec sp_executesql
@stmt=N'UPDATE CUSTOMER
SET [REQUEST] = @19, [DISC_EXPRY] = @28, [GROUP1] = @29, [GROUP2] = @31, [PR_LEVEL] = @48, [MOD_DATE] = @55, [MEM_CODE] = @63, [MEM_DATE] = @64, [HO_MOD] = @66, [LASTUPDATE] = @78
WHERE [ID] = @Old_1'
, @params=N'@19 nvarchar(4),@28 DateTime,@29 nvarchar(5),@31 nvarchar(5),@48 nvarchar(1),@55 DateTime,@63 nvarchar(7),@64 DateTime,@66 Integer,@78 Float,@Old_1 Integer',
@19= 'NRMA',@28= '1752-09-14',@29= 'ALBUM',@31= 'FRAME',@48= 'A',@55= '2006-10-10',@63= '1003.50',@64= '2006-10-10',@66= 3,@78= 39000.190633,@Old_1= 454636
however, as soon as I remove the datetime fields it works
exec sp_executesql
@stmt=N'UPDATE CUSTOMER
SET [REQUEST] = @19, [GROUP1] = @29, [GROUP2] = @31, [PR_LEVEL] = @48, [MEM_CODE] = @63, [HO_MOD] = @66, [LASTUPDATE] = @78
WHERE [ID] = @Old_1'
, @params=N'@19 nvarchar(4),@29 nvarchar(5),@31 nvarchar(5),@48 nvarchar(1),@63 nvarchar(7),@66 Integer,@78 Float,@Old_1 Integer',
@19= 'NRMA',@29= 'ALBUM',@31= 'FRAME',@48= 'A',@63= '1003.50',@66= 3,@78= 39000.190633,@Old_1= 454636
what am I doing wrong with the datetime parameters?
Grimhael
View 4 Replies
View Related