Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Tuesday, March 27, 2012

DB attach error

Hi,
When we attach one of our databases, sql server shows this error:
Error 3624:
Location: recorvery.c:2440
Expression: seenCkptEnd
ProcessId: 1388
Is there any way to recovery this database. Unfortunately we have no backup

(I'm using sql server 2000 [service pack3 installed] and we have tried
attach a lot of pc/sql server)
Sp_attach_db might not work if the database wasn't cleanly detached using
sp_detach_db. Since you have no backup, I suggest you contact Microsoft PSS
to help you salvage data. You might be able to rebuild the log using
unsupported techniques (a Google search can find these) but data integrity
will be questionable without proper database recovery.
Hope this helps.
Dan Guzman
SQL Server MVP
"Dolphin" <d@.d.com> wrote in message
news:uGNKHitJEHA.1132@.TK2MSFTNGP12.phx.gbl...
> Hi,
> When we attach one of our databases, sql server shows this error:
> Error 3624:
> Location: recorvery.c:2440
> Expression: seenCkptEnd
> ProcessId: 1388
> Is there any way to recovery this database. Unfortunately we have no
backup
>
> (I'm using sql server 2000 [service pack3 installed] and we have tried
> attach a lot of pc/sql server)
>
|||Hi,
This is most likely to be due to a bug in SQL Server. You could need to open
a case with Microsoft to get it resolved.
Thanks
Hari
MCDBA
"Dolphin" <d@.d.com> wrote in message
news:uGNKHitJEHA.1132@.TK2MSFTNGP12.phx.gbl...
> Hi,
> When we attach one of our databases, sql server shows this error:
> Error 3624:
> Location: recorvery.c:2440
> Expression: seenCkptEnd
> ProcessId: 1388
> Is there any way to recovery this database. Unfortunately we have no
backup
>
> (I'm using sql server 2000 [service pack3 installed] and we have tried
> attach a lot of pc/sql server)
>
|||You can create a new database with the same name and filenames and
locations as the one you want to attach. Then stop SQL Server and replace
the new files with the files from the detached database. Start SQL Server.
If the database comes up suspect, put it in emergency mode and run DBCC
Checkdb on it. Depending on what Checkdb returns you may be able to salvage
the data by BCPing it out.
Rand
This posting is provided "as is" with no warranties and confers no rights.

DB attach error

Hi,
When we attach one of our databases, sql server shows this error:
Error 3624:
Location: recorvery.c:2440
Expression: seenCkptEnd
ProcessId: 1388
Is there any way to recovery this database. Unfortunately we have no backup

(I'm using sql server 2000 [service pack3 installed] and we have tried
attach a lot of pc/sql server)Sp_attach_db might not work if the database wasn't cleanly detached using
sp_detach_db. Since you have no backup, I suggest you contact Microsoft PSS
to help you salvage data. You might be able to rebuild the log using
unsupported techniques (a Google search can find these) but data integrity
will be questionable without proper database recovery.
Hope this helps.
Dan Guzman
SQL Server MVP
"Dolphin" <d@.d.com> wrote in message
news:uGNKHitJEHA.1132@.TK2MSFTNGP12.phx.gbl...
> Hi,
> When we attach one of our databases, sql server shows this error:
> Error 3624:
> Location: recorvery.c:2440
> Expression: seenCkptEnd
> ProcessId: 1388
> Is there any way to recovery this database. Unfortunately we have no
backup
>
> (I'm using sql server 2000 [service pack3 installed] and we have tried
> attach a lot of pc/sql server)
>|||Hi,
This is most likely to be due to a bug in SQL Server. You could need to open
a case with Microsoft to get it resolved.
Thanks
Hari
MCDBA
"Dolphin" <d@.d.com> wrote in message
news:uGNKHitJEHA.1132@.TK2MSFTNGP12.phx.gbl...
> Hi,
> When we attach one of our databases, sql server shows this error:
> Error 3624:
> Location: recorvery.c:2440
> Expression: seenCkptEnd
> ProcessId: 1388
> Is there any way to recovery this database. Unfortunately we have no
backup
>
> (I'm using sql server 2000 [service pack3 installed] and we have tried
> attach a lot of pc/sql server)
>|||You can create a new database with the same name and filenames and
locations as the one you want to attach. Then stop SQL Server and replace
the new files with the files from the detached database. Start SQL Server.
If the database comes up suspect, put it in emergency mode and run DBCC
Checkdb on it. Depending on what Checkdb returns you may be able to salvage
the data by BCPing it out.
Rand
This posting is provided "as is" with no warranties and confers no rights.

DB attach error

Hi,
When we attach one of our databases, sql server shows this error:
Error 3624:
Location: recorvery.c:2440
Expression: seenCkptEnd
ProcessId: 1388
Is there any way to recovery this database. Unfortunately we have no backup
:(
(I'm using sql server 2000 [service pack3 installed] and we have tried
attach a lot of pc/sql server)Sp_attach_db might not work if the database wasn't cleanly detached using
sp_detach_db. Since you have no backup, I suggest you contact Microsoft PSS
to help you salvage data. You might be able to rebuild the log using
unsupported techniques (a Google search can find these) but data integrity
will be questionable without proper database recovery.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Dolphin" <d@.d.com> wrote in message
news:uGNKHitJEHA.1132@.TK2MSFTNGP12.phx.gbl...
> Hi,
> When we attach one of our databases, sql server shows this error:
> Error 3624:
> Location: recorvery.c:2440
> Expression: seenCkptEnd
> ProcessId: 1388
> Is there any way to recovery this database. Unfortunately we have no
backup
> :(
> (I'm using sql server 2000 [service pack3 installed] and we have tried
> attach a lot of pc/sql server)
>|||Hi,
This is most likely to be due to a bug in SQL Server. You could need to open
a case with Microsoft to get it resolved.
Thanks
Hari
MCDBA
"Dolphin" <d@.d.com> wrote in message
news:uGNKHitJEHA.1132@.TK2MSFTNGP12.phx.gbl...
> Hi,
> When we attach one of our databases, sql server shows this error:
> Error 3624:
> Location: recorvery.c:2440
> Expression: seenCkptEnd
> ProcessId: 1388
> Is there any way to recovery this database. Unfortunately we have no
backup
> :(
> (I'm using sql server 2000 [service pack3 installed] and we have tried
> attach a lot of pc/sql server)
>|||You can create a new database with the same name and filenames and
locations as the one you want to attach. Then stop SQL Server and replace
the new files with the files from the detached database. Start SQL Server.
If the database comes up suspect, put it in emergency mode and run DBCC
Checkdb on it. Depending on what Checkdb returns you may be able to salvage
the data by BCPing it out.
Rand
This posting is provided "as is" with no warranties and confers no rights.

DB Acess slowing Down Drastically

hello,
i am getting a problem
suddenly the DB in Sql2000 has slowed down drastically
and when i have checked the logs the error is
Supersocket info:[spn register]:error 1355
pls. help me
pavanIf you use "domain user account", to run your sql server, who does not have requisite permissions to register SPNs. You will get that message but I believe that is not the reson why your server is slow.

How old are your statistics?

/Mats|||Has anything on the network infrastructure side changed? New nics or switches? Makesure both the nic and port on the switch are configured identically. ie configure the nic for 100 full duplex and the switch port for 100 full duplex.

I've experienced sudden performance drops when the network crew put in a new switch. The nic was configured 100 full duplex and the switch port for auto negotiate. This was a problem and was fixed by setting the switch port to 100 full duplex.

There could be many other things which would do this.

Daylight Savings Time error SQL SERVER 2000

Hi all.
I used tzedit to update the daylight savings time setting on my windows 2000
server.. Now, when I run any of my reports, I get this error:
"An internal error occurred on the report server. See the error log for more
details. (rsInternalError) Get Online Help
Specified argument was out of the range of valid values. Parameter name:
date "
Does anyone have or heard of a solution?Maybe there's a patch for sql 2000, i fixed my win 2003 server and didn't
encounter this issue with my SQL 2005.
"jereviscious" <here@.there.com> wrote in message
news:eEmN81vaHHA.4396@.TK2MSFTNGP06.phx.gbl...
> Hi all.
> I used tzedit to update the daylight savings time setting on my windows
> 2000 server.. Now, when I run any of my reports, I get this error:
> "An internal error occurred on the report server. See the error log for
> more details. (rsInternalError) Get Online Help
> Specified argument was out of the range of valid values. Parameter name:
> date "
> Does anyone have or heard of a solution?
>|||Since Windows 2000 server isn't officially supported any more, microsoft
didn't release a patch. They did, however, issue this knowledge base
article, which I followed..
http://support.microsoft.com/kb/914387
and everything else appears to be working fine. All of my servers are
reporting the correct time and date. However, SQL SERVER is giving me this
problem, and I have no idea how to go about fixing it...
"Julien Bonnier" <julien@.m0851.com> wrote in message
news:OM3DXKwaHHA.3584@.TK2MSFTNGP02.phx.gbl...
> Maybe there's a patch for sql 2000, i fixed my win 2003 server and didn't
> encounter this issue with my SQL 2005.
>
> "jereviscious" <here@.there.com> wrote in message
> news:eEmN81vaHHA.4396@.TK2MSFTNGP06.phx.gbl...
>> Hi all.
>> I used tzedit to update the daylight savings time setting on my windows
>> 2000 server.. Now, when I run any of my reports, I get this error:
>> "An internal error occurred on the report server. See the error log for
>> more details. (rsInternalError) Get Online Help
>> Specified argument was out of the range of valid values. Parameter name:
>> date "
>> Does anyone have or heard of a solution?
>

Daylight Savings Time error SQL SERVER 2000

Hi all.

After DST change (US/Canada), when I run any of my reports, I get this error:

"An internal error occurred on the report server. See the error log for more
details. (rsInternalError) Get Online Help
Specified argument was out of the range of valid values. Parameter name:
date "

Does anyone have or heard of a solution?

Thank you!

What is your date format, MM/DD/YYYY or DD/MM/YYYY?|||

Try installing SQL Server 2005 (and restore the databases on it) and run the reports.

Shyam

|||mm/dd/yyyy|||

I cannot give up using SQL Server 2000 just because of this issue

|||

I do not think you need to give up on SQL 2000 for this.

Can you share the script where you pass in the parameters?

|||<Value>=Globals!ReportName &amp;" between " &amp; Parameters!startdate.Value &amp; " &amp; " &amp; Parameters!enddate.Value</Value>
...
<ReportParameters>
<ReportParameter Name="startdate">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>=CDate(cstr(year(Now())) + "/" + "01" + "/" + "01" + " 00:00:01")</Value>
</Values>
</DefaultValue>
<Prompt>Start Date-Time (MM/DD/YYYY HH:MM:SS AM or PM)</Prompt>
</ReportParameter>
<ReportParameter Name="enddate">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>=CDate(cstr(year(Now())) + "/" + cstr(month(now())) + "/" + cstr(day(now())) + " 23:59:59")</Value>
</Values>
</DefaultValue>
<Prompt>End Date-Time (MM/DD/YYYY HH:MM:SS AM or PM)</Prompt>
</ReportParameter>
<ReportParameter Name="Team">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>%</Value>
</Values>
</DefaultValue>
<Prompt>Enter a Team with % as a wildcard character i.e. %Cust%</Prompt>
</ReportParameter>
</ReportParameters>|||

I do not see any problems in the script.

Please take a look at the server log and here's something for reference. If possible, please post what you can find from the log. HTH.

http://blogs.msdn.com/jgalla/archive/2006/12/05/diagnosing-rsinternalcatalogexception.aspx

|||

Problem was resolved after power outage ;) and server restart.

|||Reboot is always the "best" solution for all MS issues.

Wednesday, March 21, 2012

DateTime string insert into sql datetime column fails

Iam trying to write to a DateTime field in MSSQL from wonderware
intouch. The problem is that I keep getting the error that the string
I'm using is not a valid datetime string....has anybody experienced
this and what was the workaround?
Thanks
GaryThis should arm you with enough information to understand why the operation
fails:
http://www.karaszi.com/SQLServer/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<GaryCharlotte@.Charter.net> wrote in message
news:1145071019.588279.87720@.i39g2000cwa.googlegroups.com...
> Iam trying to write to a DateTime field in MSSQL from wonderware
> intouch. The problem is that I keep getting the error that the string
> I'm using is not a valid datetime string....has anybody experienced
> this and what was the workaround?
> Thanks
> Gary
>|||Thank you Tibor.
I have tried various combinations including the recommended on that
site ie '02/23/1998 14:23:05'
Still no joy. I wonder if this is a wonderware sqlinsert problem...|||> I have tried various combinations including the recommended on that
> site ie '02/23/1998 14:23:05'
That's not recommended, it will fail if, for example, your dateformat is
dmy.
What does "no joy" mean? Does it fail? With what error? Did you try a
safe standard format like
'19980223 14:23:05'
?|||OK I found out what the problem is. If you use a SQLInsertprepare and
SQLInsertexecute it fails no matter what format you use.
Used SQLConnect, SQLInsert and SQLDisconnect and it works great!
Thanks for the help Tiborsql

DateTime SQL Server

Hi there!

I terribly need help in understanding what this error means - "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."
Basically, I have the date value from calendar control and inserting it into SQL Server 2000. Any ideas??

Thank you.Read the rror again :-)

Then look at your date. The formatting is wrong and SQL Server tries to mmisinterpret the fields. When it "f%*ks up" with month and date, the date can be 25 - this is out of range for a month.

You need to make sure the datetime you enter is in the correct form.

::I have the date value from calendar control and inserting it into SQL Server 2000. Any
::ideas??

Not matching cultures.

DateTime Problem in SP

I am getting this error in the SP shown below and don't see what is wrong?
Syntax error converting character string to smalldatetime data type.
The complete output is as follows:
---
DECLARE @.RC int
DECLARE @.Class char(2)
DECLARE @.StartDate datetime
DECLARE @.EndDate datetime
DECLARE @.Period varchar(10)
SELECT @.Class = 'SW'
SELECT @.StartDate = '2/5/2005'
SELECT @.EndDate = '2/13/2005'
SELECT @.Period = 'Test'
EXEC @.RC = [DB_136571].[dbo].[AddMinMax] @.Class, @.StartDate, @.EndDate,
@.Period
DECLARE @.PrnLine nvarchar(4000)
PRINT 'Stored Procedure: DB_136571.dbo.AddMinMax'
SELECT @.PrnLine = ' Return Code = ' + CONVERT(nvarchar, @.RC)
PRINT @.PrnLine
---
=============== SP Code ================
@.Class As char(2),
@.StartDate As SmallDateTime,
@.EndDate As SmallDateTime,
@.Period As Varchar(10)
As
Set NOCOUNT ON
DECLARE
@.strSQL As varchar(1000)
SET @.strSQL = 'Select UnitName, UnitClass, Max(GrossScore) From YTD WHERE
Showdate => ''' + Cast(@.startdate As SmallDateTime) + ''' AND ShowDate =<
''' + Cast(@.EndDate As SmallDateTime) + ''
Print @.strSQL
INSERT INTO MinMax(UnitName, UnitClass, Maxscore)
exec(@.strSQL)Maybe your system is set up for UK English, or some other regional settings,
or some other language.
How about we try a sensible and unambiguous date format, like YYYYMMDD.
SELECT @.startDate = '20050205', @.endDate = '20050213'
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
news:O9NBn5OKFHA.3420@.tk2msftngp13.phx.gbl...
> I am getting this error in the SP shown below and don't see what is wrong?
> Syntax error converting character string to smalldatetime data type.
> The complete output is as follows:
> ---
> DECLARE @.RC int
> DECLARE @.Class char(2)
> DECLARE @.StartDate datetime
> DECLARE @.EndDate datetime
> DECLARE @.Period varchar(10)
> SELECT @.Class = 'SW'
> SELECT @.StartDate = '2/5/2005'
> SELECT @.EndDate = '2/13/2005'
> SELECT @.Period = 'Test'
> EXEC @.RC = [DB_136571].[dbo].[AddMinMax] @.Class, @.StartDate, @.EndDate,
> @.Period
> DECLARE @.PrnLine nvarchar(4000)
> PRINT 'Stored Procedure: DB_136571.dbo.AddMinMax'
> SELECT @.PrnLine = ' Return Code = ' + CONVERT(nvarchar, @.RC)
> PRINT @.PrnLine
> ---
> =============== SP Code ================
> @.Class As char(2),
> @.StartDate As SmallDateTime,
> @.EndDate As SmallDateTime,
> @.Period As Varchar(10)
> As
> Set NOCOUNT ON
> DECLARE
> @.strSQL As varchar(1000)
> SET @.strSQL = 'Select UnitName, UnitClass, Max(GrossScore) From YTD WHERE
> Showdate => ''' + Cast(@.startdate As SmallDateTime) + ''' AND ShowDate =<
> ''' + Cast(@.EndDate As SmallDateTime) + ''
> Print @.strSQL
> INSERT INTO MinMax(UnitName, UnitClass, Maxscore)
> exec(@.strSQL)
>|||Well for one thing You have "=>" In there, and that's wrong, it should be
">=".
Second, '2/13/2005' _COULD_ be getting interpreted as 2nd day of 13th
month... depending on server settings... A format that always works is
CCYYMMDD, or, for Feb 13, 2005,
'20050213'
try changing the string literals
SELECT @.StartDate = '2/5/2005'
SELECT @.EndDate = '2/13/2005'
to
SELECT @.StartDate = '20050205'
SELECT @.EndDate = '20050213'
and see if it works then...
"Wayne Wengert" wrote:

> I am getting this error in the SP shown below and don't see what is wrong?
> Syntax error converting character string to smalldatetime data type.
> The complete output is as follows:
> ---
> DECLARE @.RC int
> DECLARE @.Class char(2)
> DECLARE @.StartDate datetime
> DECLARE @.EndDate datetime
> DECLARE @.Period varchar(10)
> SELECT @.Class = 'SW'
> SELECT @.StartDate = '2/5/2005'
> SELECT @.EndDate = '2/13/2005'
> SELECT @.Period = 'Test'
> EXEC @.RC = [DB_136571].[dbo].[AddMinMax] @.Class, @.StartDate, @.EndDate,
> @.Period
> DECLARE @.PrnLine nvarchar(4000)
> PRINT 'Stored Procedure: DB_136571.dbo.AddMinMax'
> SELECT @.PrnLine = ' Return Code = ' + CONVERT(nvarchar, @.RC)
> PRINT @.PrnLine
> ---
> =============== SP Code ================
> @.Class As char(2),
> @.StartDate As SmallDateTime,
> @.EndDate As SmallDateTime,
> @.Period As Varchar(10)
> As
> Set NOCOUNT ON
> DECLARE
> @.strSQL As varchar(1000)
> SET @.strSQL = 'Select UnitName, UnitClass, Max(GrossScore) From YTD WHERE
> Showdate => ''' + Cast(@.startdate As SmallDateTime) + ''' AND ShowDate =<
> ''' + Cast(@.EndDate As SmallDateTime) + ''
> Print @.strSQL
> INSERT INTO MinMax(UnitName, UnitClass, Maxscore)
> exec(@.strSQL)
>
>|||Wayne Wengert wrote:
> I am getting this error in the SP shown below and don't see what is wrong?
> Syntax error converting character string to smalldatetime data type.
> The complete output is as follows:
> ---
> DECLARE @.RC int
> DECLARE @.Class char(2)
> DECLARE @.StartDate datetime
> DECLARE @.EndDate datetime
> DECLARE @.Period varchar(10)
> SELECT @.Class = 'SW'
> SELECT @.StartDate = '2/5/2005'
> SELECT @.EndDate = '2/13/2005'
> SELECT @.Period = 'Test'
> EXEC @.RC = [DB_136571].[dbo].[AddMinMax] @.Class, @.StartDate, @.EndDate,
> @.Period
> DECLARE @.PrnLine nvarchar(4000)
> PRINT 'Stored Procedure: DB_136571.dbo.AddMinMax'
> SELECT @.PrnLine = ' Return Code = ' + CONVERT(nvarchar, @.RC)
> PRINT @.PrnLine
> ---
> =============== SP Code ================
> @.Class As char(2),
> @.StartDate As SmallDateTime,
> @.EndDate As SmallDateTime,
> @.Period As Varchar(10)
> As
> Set NOCOUNT ON
> DECLARE
> @.strSQL As varchar(1000)
> SET @.strSQL = 'Select UnitName, UnitClass, Max(GrossScore) From YTD WHERE
> Showdate => ''' + Cast(@.startdate As SmallDateTime) + ''' AND ShowDate =<
> ''' + Cast(@.EndDate As SmallDateTime) + ''
> Print @.strSQL
> INSERT INTO MinMax(UnitName, UnitClass, Maxscore)
> exec(@.strSQL)
--BEGIN PGP SIGNED MESSAGE--
Hash: SHA1
Your WHERE clause should be like this:
WHERE Showdate >= ''' + Convert(char(8),@.StartDate,112) + '''
AND ShowDate <= ''' + Convert(char(8), @.EndDate, 112) + ''''
Since you've already declared the parameters @.StartDate & @.EndDate as
SmallDateTime data types you don't have to do it again w/ the Cast()
function. What you have to do, since you're putting the date values in
a string, is convert them to string data types. In my example I used
CHAR(8) to just get a date like this '20040314'.
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
--BEGIN PGP SIGNATURE--
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/ AwUBQjYjzoechKqOuFEgEQKVLwCg9K2hY2Pnsi9Y
gASMQFvboh8aV1cAnAka
Fnny1XBrRp8n15Q7xe4Mm6VR
=GT97
--END PGP SIGNATURE--|||And Oh, replace "=>" and "=<" with ">=", and "<="
"Wayne Wengert" wrote:

> I am getting this error in the SP shown below and don't see what is wrong?
> Syntax error converting character string to smalldatetime data type.
> The complete output is as follows:
> ---
> DECLARE @.RC int
> DECLARE @.Class char(2)
> DECLARE @.StartDate datetime
> DECLARE @.EndDate datetime
> DECLARE @.Period varchar(10)
> SELECT @.Class = 'SW'
> SELECT @.StartDate = '2/5/2005'
> SELECT @.EndDate = '2/13/2005'
> SELECT @.Period = 'Test'
> EXEC @.RC = [DB_136571].[dbo].[AddMinMax] @.Class, @.StartDate, @.EndDate,
> @.Period
> DECLARE @.PrnLine nvarchar(4000)
> PRINT 'Stored Procedure: DB_136571.dbo.AddMinMax'
> SELECT @.PrnLine = ' Return Code = ' + CONVERT(nvarchar, @.RC)
> PRINT @.PrnLine
> ---
> =============== SP Code ================
> @.Class As char(2),
> @.StartDate As SmallDateTime,
> @.EndDate As SmallDateTime,
> @.Period As Varchar(10)
> As
> Set NOCOUNT ON
> DECLARE
> @.strSQL As varchar(1000)
> SET @.strSQL = 'Select UnitName, UnitClass, Max(GrossScore) From YTD WHERE
> Showdate => ''' + Cast(@.startdate As SmallDateTime) + ''' AND ShowDate =<
> ''' + Cast(@.EndDate As SmallDateTime) + ''
> Print @.strSQL
> INSERT INTO MinMax(UnitName, UnitClass, Maxscore)
> exec(@.strSQL)
>
>|||Thanks - I figured that out (finally)
Wayne
"CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
news:849DC6A0-15EF-4616-BC47-555F941C4199@.microsoft.com...
> Well for one thing You have "=>" In there, and that's wrong, it should
be
> ">=".
> Second, '2/13/2005' _COULD_ be getting interpreted as 2nd day of 13th
> month... depending on server settings... A format that always works is
> CCYYMMDD, or, for Feb 13, 2005,
> '20050213'
> try changing the string literals
> SELECT @.StartDate = '2/5/2005'
> SELECT @.EndDate = '2/13/2005'
> to
> SELECT @.StartDate = '20050205'
> SELECT @.EndDate = '20050213'
> and see if it works then...
>
> "Wayne Wengert" wrote:
>
wrong?
WHERE
=<|||Thanks - that was what I forgot!
Wayne
"MGFoster" <me@.privacy.com> wrote in message
news:6tpZd.10908$cN6.9661@.newsread1.news.pas.earthlink.net...
> Wayne Wengert wrote:
wrong?
WHERE
=<
> --BEGIN PGP SIGNED MESSAGE--
> Hash: SHA1
> Your WHERE clause should be like this:
> WHERE Showdate >= ''' + Convert(char(8),@.StartDate,112) + '''
> AND ShowDate <= ''' + Convert(char(8), @.EndDate, 112) + ''''
> Since you've already declared the parameters @.StartDate & @.EndDate as
> SmallDateTime data types you don't have to do it again w/ the Cast()
> function. What you have to do, since you're putting the date values in
> a string, is convert them to string data types. In my example I used
> CHAR(8) to just get a date like this '20040314'.
> --
> MGFoster:::mgf00 <at> earthlink <decimal-point> net
> Oakland, CA (USA)
> --BEGIN PGP SIGNATURE--
> Version: PGP for Personal Privacy 5.0
> Charset: noconv
> iQA/ AwUBQjYjzoechKqOuFEgEQKVLwCg9K2hY2Pnsi9Y
gASMQFvboh8aV1cAnAka
> Fnny1XBrRp8n15Q7xe4Mm6VR
> =GT97
> --END PGP SIGNATURE--|||
> Your WHERE clause should be like this:
> WHERE Showdate >= ''' + Convert(char(8),@.StartDate,112) + '''
> AND ShowDate <= ''' + Convert(char(8), @.EndDate, 112) + ''''
This still could lead to an error if his settings are, say, UK English, and
he says
SET @.startDate = '2/16/2005'

> Since you've already declared the parameters @.StartDate & @.EndDate as
> SmallDateTime data types you don't have to do it again w/ the Cast()
Neither do you have to do a CONVERT at all in this case (if he uses YYYYMMDD
in his SET/SELECT then it's already in 112 format), and nor do you have to
surround the date value with strings like you did. This will be sufficient:
WHERE ShowDate >= @.startDate
Finally, more for Wayne than the others, be careful how you define the end
date. If you say <= <somedate_notime> you will include rows with a value of
midnight on that day, but not 12:01 AM or 3:45 PM. If you only have
midnight timestamps in the data then it's no big deal, but if you don't
constrain the data, you're better off using < (@.endDate + 1).
A

Monday, March 19, 2012

Datetime Issues

Hi,
I have an IIS query (using VB) that selects information
from a table within SQL Server 2000. When the function is
called, it gives error message "Microsoft OLE DB Provider
for SQL Server error '80040e07'". A Datetime error.
The line that fails is:
SELECT Name, Description, Reason, StartDate, EndDate,
Forename, Surname FROM V_GetPartnerships WHERE
PartnershipId = 2 AND (StartDate <= 'Wednesday, October
29, 2003' AND EndDate >= 'Wednesday, October 29, 2003')
ORDER BY name;
I have run this same line successfully by omitting
the "Wednesday, " section from the date fields, because
it does not fit in with the datetime defaults.
I have checked the outputs of the date formats using a
simple VB script, and they are as expected (i.e. October
29, 2003).
Where is it getting this extended date from'Assuming Startdate and Enddate are DATETIME or SMALLDATETIME columns, try
this:
SELECT [name], [description], reason, startdate, enddate,
forename, surname
FROM V_GetPartnerships
WHERE partnershipid = 2
AND '20031029' BETWEEN startdate AND enddate
ORDER BY name
Always specify dates in the ISO format ('YYYYMMDD') which works
independently of any regional settings.
--
David Portas
--
Please reply only to the newsgroup
--|||This is an SQL database and IIS that previously worked
OK, but has been migrated to new servers.
The date and time selections it is using determines the
query (by the use of VB Combo boxes within the website)
and any changes to this would require extensive re-
writing of the VB codes.
The datetime field works OK when using correct date
terms, as previously tested, it is only when it using
this extended 'Wednesday, October 29, 2003' that is NOT
recognised by the field.
Any ideas where it would be getting this time field from?
I.E. IIS or SQL Server properties etc.
Or is it possible to update SQL to allow for the day,
month date, year datetime fields.
>--Original Message--
>Assuming Startdate and Enddate are DATETIME or
SMALLDATETIME columns, try
>this:
>SELECT [name], [description], reason, startdate, enddate,
> forename, surname
> FROM V_GetPartnerships
> WHERE partnershipid = 2
> AND '20031029' BETWEEN startdate AND enddate
> ORDER BY name
>Always specify dates in the ISO format ('YYYYMMDD')
which works
>independently of any regional settings.
>--
>David Portas
>--
>Please reply only to the newsgroup
>--
>
>.
>|||SQL Server does not understand below "extended" format. Take the time to do it right, use the format
recommended by David, and you will not run into all kind of problems later. Or read about the
supported formats in Books Online:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_con_03_765d.asp?frame=true
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Martin Powell" <anonymous@.discussions.microsoft.com> wrote in message
news:0c4b01c39e29$26996260$a501280a@.phx.gbl...
> This is an SQL database and IIS that previously worked
> OK, but has been migrated to new servers.
> The date and time selections it is using determines the
> query (by the use of VB Combo boxes within the website)
> and any changes to this would require extensive re-
> writing of the VB codes.
> The datetime field works OK when using correct date
> terms, as previously tested, it is only when it using
> this extended 'Wednesday, October 29, 2003' that is NOT
> recognised by the field.
> Any ideas where it would be getting this time field from?
> I.E. IIS or SQL Server properties etc.
> Or is it possible to update SQL to allow for the day,
> month date, year datetime fields.
> >--Original Message--
> >Assuming Startdate and Enddate are DATETIME or
> SMALLDATETIME columns, try
> >this:
> >
> >SELECT [name], [description], reason, startdate, enddate,
> > forename, surname
> > FROM V_GetPartnerships
> > WHERE partnershipid = 2
> > AND '20031029' BETWEEN startdate AND enddate
> > ORDER BY name
> >
> >Always specify dates in the ISO format ('YYYYMMDD')
> which works
> >independently of any regional settings.
> >
> >--
> >David Portas
> >--
> >Please reply only to the newsgroup
> >--
> >
> >
> >.
> >|||I am aware that SQL does not support the format that is
in use, the issue is that it is getting this format from
somewhere within the system.
This database has been developed over several years and
recently migrated to new servers and this error has only
appears on the new system. It DOES NOT affect the old
system.
Any ideas where it would be getting this time field from?
>--Original Message--
>SQL Server does not understand below "extended" format.
Take the time to do it right, use the format
>recommended by David, and you will not run into all kind
of problems later. Or read about the
>supported formats in Books Online:
>http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/acdata/ac_8_con_03_765d.asp?frame=true
>--
>Tibor Karaszi, SQL Server MVP
>Archive at: http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Martin Powell" <anonymous@.discussions.microsoft.com>
wrote in message
>news:0c4b01c39e29$26996260$a501280a@.phx.gbl...
>> This is an SQL database and IIS that previously worked
>> OK, but has been migrated to new servers.
>> The date and time selections it is using determines the
>> query (by the use of VB Combo boxes within the website)
>> and any changes to this would require extensive re-
>> writing of the VB codes.
>> The datetime field works OK when using correct date
>> terms, as previously tested, it is only when it using
>> this extended 'Wednesday, October 29, 2003' that is NOT
>> recognised by the field.
>> Any ideas where it would be getting this time field
from?
>> I.E. IIS or SQL Server properties etc.
>> Or is it possible to update SQL to allow for the day,
>> month date, year datetime fields.
>> >--Original Message--
>> >Assuming Startdate and Enddate are DATETIME or
>> SMALLDATETIME columns, try
>> >this:
>> >
>> >SELECT [name], [description], reason, startdate,
enddate,
>> > forename, surname
>> > FROM V_GetPartnerships
>> > WHERE partnershipid = 2
>> > AND '20031029' BETWEEN startdate AND enddate
>> > ORDER BY name
>> >
>> >Always specify dates in the ISO format ('YYYYMMDD')
>> which works
>> >independently of any regional settings.
>> >
>> >--
>> >David Portas
>> >--
>> >Please reply only to the newsgroup
>> >--
>> >
>> >
>> >.
>> >
>
>.
>|||Ahh, I see. I'm no ASP expert, but this is where you have to look (in the application code).
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
<anonymous@.discussions.microsoft.com> wrote in message
news:062801c39e2c$1c858d50$a001280a@.phx.gbl...
> I am aware that SQL does not support the format that is
> in use, the issue is that it is getting this format from
> somewhere within the system.
> This database has been developed over several years and
> recently migrated to new servers and this error has only
> appears on the new system. It DOES NOT affect the old
> system.
> Any ideas where it would be getting this time field from?
> >--Original Message--
> >SQL Server does not understand below "extended" format.
> Take the time to do it right, use the format
> >recommended by David, and you will not run into all kind
> of problems later. Or read about the
> >supported formats in Books Online:
> >http://msdn.microsoft.com/library/default.asp?
> url=/library/en-us/acdata/ac_8_con_03_765d.asp?frame=true
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at: http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Martin Powell" <anonymous@.discussions.microsoft.com>
> wrote in message
> >news:0c4b01c39e29$26996260$a501280a@.phx.gbl...
> >> This is an SQL database and IIS that previously worked
> >> OK, but has been migrated to new servers.
> >>
> >> The date and time selections it is using determines the
> >> query (by the use of VB Combo boxes within the website)
> >> and any changes to this would require extensive re-
> >> writing of the VB codes.
> >>
> >> The datetime field works OK when using correct date
> >> terms, as previously tested, it is only when it using
> >> this extended 'Wednesday, October 29, 2003' that is NOT
> >> recognised by the field.
> >>
> >> Any ideas where it would be getting this time field
> from?
> >> I.E. IIS or SQL Server properties etc.
> >>
> >> Or is it possible to update SQL to allow for the day,
> >> month date, year datetime fields.
> >>
> >> >--Original Message--
> >> >Assuming Startdate and Enddate are DATETIME or
> >> SMALLDATETIME columns, try
> >> >this:
> >> >
> >> >SELECT [name], [description], reason, startdate,
> enddate,
> >> > forename, surname
> >> > FROM V_GetPartnerships
> >> > WHERE partnershipid = 2
> >> > AND '20031029' BETWEEN startdate AND enddate
> >> > ORDER BY name
> >> >
> >> >Always specify dates in the ISO format ('YYYYMMDD')
> >> which works
> >> >independently of any regional settings.
> >> >
> >> >--
> >> >David Portas
> >> >--
> >> >Please reply only to the newsgroup
> >> >--
> >> >
> >> >
> >> >.
> >> >
> >
> >
> >.
> >|||If you are asking why IIS or VB is formatting the date this way then I
really don't know. Presumably it's defined by a regional setting on the
server - it looks like a Windows "Long" date format. This isn't a SQLServer
question so you'll probably get more help posting to an IIS group.
--
David Portas
--
Please reply only to the newsgroup
--|||Thanks Guys,
Will try with IIS, now SQL has been ruled out!
>--Original Message--
>If you are asking why IIS or VB is formatting the date
this way then I
>really don't know. Presumably it's defined by a regional
setting on the
>server - it looks like a Windows "Long" date format.
This isn't a SQLServer
>question so you'll probably get more help posting to an
IIS group.
>--
>David Portas
>--
>Please reply only to the newsgroup
>--
>
>.
>

Sunday, March 11, 2012

datetime field overflow

Why would i get a "datetime field overflow" error ? Under what conditions ?
ThanksDATETIME data type can hold a date between January 1, 1753 and December 31,
9999. SMALLDATETIME can hold a date between January 1, 1900 and June 6,
2079. Trying to set a DATETIME column outside of these ranges will cause an
error.
"Hassan" <Hassan@.hotmail.com> wrote in message
news:exDd7YkkGHA.2200@.TK2MSFTNGP05.phx.gbl...
> Why would i get a "datetime field overflow" error ? Under what conditions
> ?
> Thanks
>

DateTime error in stored procedure

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.You are missing a couple of @. signs. Should be:


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

Thursday, March 8, 2012

DateTime Error

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

You should convert src_terrier.datadate not to datetime (it IS datedime, after all :) ), but to varchar. And no, you don't need N in this case.

HTH :)

|||Hi,

first of all, this is right, you don′t need to N the datestring. If you want to pass the "datestring as a string, I would rather prefer passing it as ISO date e.g. 20040101 rather than in a formatted way. Then you need to convert it to VARCHAR if you use a format / convert function. The isu code for formatting to 20040101 is 112, so this should be something like

WHERE (CONVERT(VARCHAR(10),src_terrier.datadate,112) = @.dt_src_date) AND..........

The other option you could use, which would normally better keep track of an index rather than convert all the datetimes stored in your table. Use datediff, it should be 0 if you compare by days and the record is of the same day as the imput paramter.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

Is src_terrier.datadate column smalldatetime/datetime? If not you should first change it to one of the datetime data types so you can manipulate the data efficiently and perform searches in meaningful manner. As for the input, you can use the ISO unseparated format as mentioned so the code works under any language settings. If you are going to pass the value in a specific format then perform a conversion in the code like:

convert(datetime, @.dt_src_date, 101 )

convert(datetime, @.dt_src_date, 103)

If you try there and it doesn't resolve the problem then please post a sample script with DDL & data so it is easy to see what the schema looks like and the actual code.

datetime error

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.Does november contain 31 days ... hmm .. something is very wrong with your code
this works :-
select convert(datetime,'Nov 30, 2002 10:41PM',107)|||Originally posted by Enigma
Does november contain 31 days ... hmm .. something is very wrong with your code
this works :-
select convert(datetime,'Nov 30, 2002 10:41PM',107)

:D :D :D
how foolish of me!!
actually this was the input to a proc and the parameters were provided by the programmers, so i just tried to check with the same.
nways thnxs.
regards,
harsh.

datetime error

Hello,
Need some help with this:
I have SQL server 2000.
I run a query with the following where clause:
WHERE last_call_date >= '2006-06-01 00:00:00'
AND last_call_date <= '2006-06-02 23:59:59'
last_call_date is a datetime field.
I get results including these:
2006-06-03 00:00:00.000
why is this happening? I really don't know what to say... this for me is a
terrible thing.
Any help?
Thanks
Eduardo SicouretSorry this is the actual where clause:
WHERE last_call_date >= '2006-06-01 00:00:00.000'
AND last_call_date <= '2006-06-02 23:59:59.999'
Eduardo Sicouret
"Eduardo Sicouret" <esicouret> escribió en el mensaje
news:OD7WGb0iGHA.836@.TK2MSFTNGP02.phx.gbl...
> Hello,
> Need some help with this:
> I have SQL server 2000.
> I run a query with the following where clause:
> WHERE last_call_date >= '2006-06-01 00:00:00'
> AND last_call_date <= '2006-06-02 23:59:59'
> last_call_date is a datetime field.
> I get results including these:
> 2006-06-03 00:00:00.000
> why is this happening? I really don't know what to say... this for me is
> a terrible thing.
> Any help?
> Thanks
> Eduardo Sicouret
>|||Eduardo Sicouret wrote:
> Sorry this is the actual where clause:
> WHERE last_call_date >=3D '2006-06-01 00:00:00.000'
> AND last_call_date <=3D '2006-06-02 23:59:59.999'
> Eduardo Sicouret
> "Eduardo Sicouret" <esicouret> escribi=F3 en el mensaje
> news:OD7WGb0iGHA.836@.TK2MSFTNGP02.phx.gbl...
> > Hello,
> >
> > Need some help with this:
> >
> > I have SQL server 2000.
> >
> > I run a query with the following where clause:
> >
> > WHERE last_call_date >=3D '2006-06-01 00:00:00'
> > AND last_call_date <=3D '2006-06-02 23:59:59'
> >
> > last_call_date is a datetime field.
> >
> > I get results including these:
> >
> > 2006-06-03 00:00:00.000
> >
> > why is this happening? I really don't know what to say... this for me= is
> > a terrible thing.
> >
> > Any help?
> >
> > Thanks
> >
> > Eduardo Sicouret
> >
Use one of the following, otherwise the tail end of your date range
gets rounded up. The first example is the simplest and best IMO. If you
do use the format with both date and time then don't leave out the "T"
separator - it's important.
.=2E.
WHERE last_call_date >=3D '20060601'
AND last_call_date < '20060603'
.=2E.
WHERE last_call_date >=3D '2006-06-01T00:00:00.000'
AND last_call_date < '2006-06-03T00:00:00.000'
.=2E.
WHERE last_call_date >=3D '2006-06-01T00:00:00.000'
AND last_call_date <=3D '2006-06-02T23:59:59.997'
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Try using CONVERT(DATETIME,last_call_date,20)
Jayesh
"Eduardo Sicouret" <esicouret> wrote in message
news:OD7WGb0iGHA.836@.TK2MSFTNGP02.phx.gbl...
> Hello,
> Need some help with this:
> I have SQL server 2000.
> I run a query with the following where clause:
> WHERE last_call_date >= '2006-06-01 00:00:00'
> AND last_call_date <= '2006-06-02 23:59:59'
> last_call_date is a datetime field.
> I get results including these:
> 2006-06-03 00:00:00.000
> why is this happening? I really don't know what to say... this for me is
> a terrible thing.
> Any help?
> Thanks
> Eduardo Sicouret
>

datetime error

Hello,
Need some help with this:
I have SQL server 2000.
I run a query with the following where clause:
WHERE last_call_date >= '2006-06-01 00:00:00'
AND last_call_date <= '2006-06-02 23:59:59'
last_call_date is a datetime field.
I get results including these:
2006-06-03 00:00:00.000
why is this happening? I really don't know what to say... this for me is a
terrible thing.
Any help?
Thanks
Eduardo SicouretSorry this is the actual where clause:
WHERE last_call_date >= '2006-06-01 00:00:00.000'
AND last_call_date <= '2006-06-02 23:59:59.999'
Eduardo Sicouret
"Eduardo Sicouret" <esicouret> escribi en el mensaje
news:OD7WGb0iGHA.836@.TK2MSFTNGP02.phx.gbl...
> Hello,
> Need some help with this:
> I have SQL server 2000.
> I run a query with the following where clause:
> WHERE last_call_date >= '2006-06-01 00:00:00'
> AND last_call_date <= '2006-06-02 23:59:59'
> last_call_date is a datetime field.
> I get results including these:
> 2006-06-03 00:00:00.000
> why is this happening? I really don't know what to say... this for me is
> a terrible thing.
> Any help?
> Thanks
> Eduardo Sicouret
>|||Eduardo Sicouret wrote:[vbcol=seagreen]
> Sorry this is the actual where clause:
> WHERE last_call_date >=3D '2006-06-01 00:00:00.000'
> AND last_call_date <=3D '2006-06-02 23:59:59.999'
> Eduardo Sicouret
> "Eduardo Sicouret" <esicouret> escribi=F3 en el mensaje
> news:OD7WGb0iGHA.836@.TK2MSFTNGP02.phx.gbl...
is[vbcol=seagreen]
Use one of the following, otherwise the tail end of your date range
gets rounded up. The first example is the simplest and best IMO. If you
do use the format with both date and time then don't leave out the "T"
separator - it's important.
.=2E.
WHERE last_call_date >=3D '20060601'
AND last_call_date < '20060603'
.=2E.
WHERE last_call_date >=3D '2006-06-01T00:00:00.000'
AND last_call_date < '2006-06-03T00:00:00.000'
.=2E.
WHERE last_call_date >=3D '2006-06-01T00:00:00.000'
AND last_call_date <=3D '2006-06-02T23:59:59.997'
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Try using CONVERT(DATETIME,last_call_date,20)
Jayesh
"Eduardo Sicouret" <esicouret> wrote in message
news:OD7WGb0iGHA.836@.TK2MSFTNGP02.phx.gbl...
> Hello,
> Need some help with this:
> I have SQL server 2000.
> I run a query with the following where clause:
> WHERE last_call_date >= '2006-06-01 00:00:00'
> AND last_call_date <= '2006-06-02 23:59:59'
> last_call_date is a datetime field.
> I get results including these:
> 2006-06-03 00:00:00.000
> why is this happening? I really don't know what to say... this for me is
> a terrible thing.
> Any help?
> Thanks
> Eduardo Sicouret
>

Datetime data type resulted in an out-of-range datetime value. Please help

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

I guess itis caused by the date format in SQL Server. Please try following statements:


set DATEFORMAT dmy
declare @.t smalldatetime
set @.t='31/08/2006 23:28:59'
select @.t

|||

Thanks Lori,

It appears that when I use parameters in my SqlCommand object this works like a treat. God bless the parameters!!

Datetime conversion under diferent versions of SQL

Hello!
I'm using the same script to insert/update records on diferent versions of
SQL but i'm getting this error:
[Microsoft][ODBC SQL Server Driver][SQL Server]A conversão de um tipo de
dados char em um tipo de dados datetime resultou em um valor datetime fora
do intervalo.
(translation: error converting one string into datetime value out of range)
The SQL versions that I am probing is 8.00.194 (RTM) that is installed with
Microsoft SQL Personal Engine CD and ther other version is 8.00.2039 (SP4)
that i've downloaded and installed.
Can anywone help me?
Regards,
kTodosYou are probably passing dates in some regional format (e.g. dd/mm/yyyy) and
this is okay on one server (which may have British language settings) but
not on another (which may have US English language, or mdy dateformat). To
avoid these problems, always pass dates as 'YYYYMMDD'...
--
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"kTodos" <kanduru.x@.iol.pt> wrote in message
news:%23YZA%23Q6rHHA.2240@.TK2MSFTNGP03.phx.gbl...
> Hello!
> I'm using the same script to insert/update records on diferent versions of
> SQL but i'm getting this error:
> [Microsoft][ODBC SQL Server Driver][SQL Server]A conversão de um tipo de
> dados char em um tipo de dados datetime resultou em um valor datetime fora
> do intervalo.
> (translation: error converting one string into datetime value out of
> range)
> The SQL versions that I am probing is 8.00.194 (RTM) that is installed
> with Microsoft SQL Personal Engine CD and ther other version is 8.00.2039
> (SP4) that i've downloaded and installed.
> Can anywone help me?
> Regards,
> kTodos
>|||... and for some extra reading: http://www.karaszi.com/SQLServer/info_datetime.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OtJcSa8rHHA.1200@.TK2MSFTNGP04.phx.gbl...
> You are probably passing dates in some regional format (e.g. dd/mm/yyyy) and this is okay on one
> server (which may have British language settings) but not on another (which may have US English
> language, or mdy dateformat). To avoid these problems, always pass dates as 'YYYYMMDD'...
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.sqlblog.com/
> http://www.aspfaq.com/5006
> "kTodos" <kanduru.x@.iol.pt> wrote in message news:%23YZA%23Q6rHHA.2240@.TK2MSFTNGP03.phx.gbl...
>> Hello!
>> I'm using the same script to insert/update records on diferent versions of SQL but i'm getting
>> this error:
>> [Microsoft][ODBC SQL Server Driver][SQL Server]A conversão de um tipo de dados char em um tipo de
>> dados datetime resultou em um valor datetime fora do intervalo.
>> (translation: error converting one string into datetime value out of range)
>> The SQL versions that I am probing is 8.00.194 (RTM) that is installed with Microsoft SQL
>> Personal Engine CD and ther other version is 8.00.2039 (SP4) that i've downloaded and installed.
>> Can anywone help me?
>> Regards,
>> kTodos
>

Wednesday, March 7, 2012

Datetime and conversion to smalldatetime.

I am placing DateTime into SQL using an ASP.NET form. The date should be formatted dd/mm/yyyy hh/mm/ss.

I am getting the error below. Is there any way to convert the format of the DateTime function from the ASP.NET end?

Thanks

mes

"The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value"

DateTimes aren't "formatted". It sounds like you are giving it a string, that you think looks like a date. Give the database a real datetime (Or specify the sqlparameter as being of datetime type), and your problem should go away. If that string format isn't valid for your culture, well... You'll have to fix that separately, or manually convert your "DateTime in a string" to a format that your SQL Server wants.

Saturday, February 25, 2012

Dates not working in SQL query

This is the query that gives the error message for 'Oct 9, 2003' on a server
but works correctly on another - what could make this happen on SQL 2000
Server: Msg 241, Level 16, State 1, Line 1
Syntax error converting datetime from character string.
SELECT count(*)
FROM Contact INNER JOIN
OrderHeader ON Contact.ContactID = OrderHeader.ContactID INNER JOIN
PledgeDetails ON OrderHeader.OrderID = PledgeDetails.OrderID
WHERE (PledgeDetails.LastPaymentDate >= 'Oct 9, 2003') AND
(PledgeDetails.AutoDeduction = 1) AND (PledgeDetails.NextDueDate >= 'Jan
1, 1980') AND
(PledgeDetails.NextDueDate <= 'Oct 9, 2003') AND
(LEFT(OrderHeader.OrderCode, 1) = '1')
AND (Contact.flag9 = 0 OR Contact.flag9 IS NULL) AND (Contact.flag10 = 0
OR Contact.flag10 IS NULL) AND (Contact.flag15 = 0 OR Contact.flag15 IS
NULL)
Regards Jeff
This is the query that gives the error message for 'Oct 9, 2003' on a server
but works correctly on another - what could make this happen on SQL 2000
Server: Msg 241, Level 16, State 1, Line 1
Syntax error converting datetime from character string.
SELECT count(*)
FROM Contact INNER JOIN
OrderHeader ON Contact.ContactID = OrderHeader.ContactID INNER JOIN
PledgeDetails ON OrderHeader.OrderID = PledgeDetails.OrderID
WHERE (PledgeDetails.LastPaymentDate >= 'Oct 9, 2003') AND
(PledgeDetails.AutoDeduction = 1) AND (PledgeDetails.NextDueDate >= 'Jan
1, 1980') AND
(PledgeDetails.NextDueDate <= 'Oct 9, 2003') AND
(LEFT(OrderHeader.OrderCode, 1) = '1')
AND (Contact.flag9 = 0 OR Contact.flag9 IS NULL) AND (Contact.flag10 = 0
OR Contact.flag10 IS NULL) AND (Contact.flag15 = 0 OR Contact.flag15 IS
NULL)
Regards Jeff
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 6/10/2003Jeff
Please refer to BOL for CONVERT function.
"Jeff Williams" <jeff.williams@.hardsoft.com.au> wrote in message
news:#AtCV9SjDHA.1672@.TK2MSFTNGP09.phx.gbl...
> This is the query that gives the error message for 'Oct 9, 2003' on a
server
> but works correctly on another - what could make this happen on SQL 2000
> Server: Msg 241, Level 16, State 1, Line 1
> Syntax error converting datetime from character string.
>
> SELECT count(*)
> FROM Contact INNER JOIN
> OrderHeader ON Contact.ContactID = OrderHeader.ContactID INNER JOIN
> PledgeDetails ON OrderHeader.OrderID = PledgeDetails.OrderID
> WHERE (PledgeDetails.LastPaymentDate >= 'Oct 9, 2003') AND
> (PledgeDetails.AutoDeduction = 1) AND (PledgeDetails.NextDueDate >= 'Jan
> 1, 1980') AND
> (PledgeDetails.NextDueDate <= 'Oct 9, 2003') AND
> (LEFT(OrderHeader.OrderCode, 1) = '1')
> AND (Contact.flag9 = 0 OR Contact.flag9 IS NULL) AND (Contact.flag10 = 0
> OR Contact.flag10 IS NULL) AND (Contact.flag15 = 0 OR Contact.flag15 IS
> NULL)
> Regards Jeff
>
> This is the query that gives the error message for 'Oct 9, 2003' on a
server
> but works correctly on another - what could make this happen on SQL 2000
> Server: Msg 241, Level 16, State 1, Line 1
> Syntax error converting datetime from character string.
>
> SELECT count(*)
> FROM Contact INNER JOIN
> OrderHeader ON Contact.ContactID = OrderHeader.ContactID INNER JOIN
> PledgeDetails ON OrderHeader.OrderID = PledgeDetails.OrderID
> WHERE (PledgeDetails.LastPaymentDate >= 'Oct 9, 2003') AND
> (PledgeDetails.AutoDeduction = 1) AND (PledgeDetails.NextDueDate >= 'Jan
> 1, 1980') AND
> (PledgeDetails.NextDueDate <= 'Oct 9, 2003') AND
> (LEFT(OrderHeader.OrderCode, 1) = '1')
> AND (Contact.flag9 = 0 OR Contact.flag9 IS NULL) AND (Contact.flag10 = 0
> OR Contact.flag10 IS NULL) AND (Contact.flag15 = 0 OR Contact.flag15 IS
> NULL)
> Regards Jeff
>
>
> --
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.524 / Virus Database: 321 - Release Date: 6/10/2003
>