Solved

Problems Microsoft SQL 2005

Posted on 2012-03-29
18
370 Views
Last Modified: 2012-04-06
We have a situation when a PC connects to the Ms SQL instance, that it would halt a specific areas and the message that appears is "data type error.

What can be causing this?
0
Comment
Question by:rayluvs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
18 Comments
 

Author Comment

by:rayluvs
ID: 37782483
Ooops, wrong error message.  Tha message is:

Msg 242, Level 16, State 3, Line 3
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

Open in new window


When debuging the VB.NET apps we see the error happens in the line where the script is:

SET @Var = (SELECT CONVERT(VARCHAR,GETDATE(),103))

Open in new window


We noticed that the Server is Ms SQL 2005 English version, but another server is Spanish version and it runs ok.  We also noticed that doing the query directly in the Studio SQL, gave same result in 2005 SQL version.

We tested other values beside 103 and it works.  We thought it was Regional, but changed it, still error.

Please adveice
0
 
LVL 15

Expert Comment

by:Anuj
ID: 37782523
0
 
LVL 8

Assisted Solution

by:gpizzuto
gpizzuto earned 100 total points
ID: 37782591
did you declare the variable  @Var
as
nvarchar (at least 10) ???

try also

SELECT CONVERT(VARCHAR(10),GETDATE(),103)
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 83

Accepted Solution

by:
CodeCruiser earned 400 total points
ID: 37782825
Try changing

SET @Var = (SELECT CONVERT(VARCHAR,GETDATE(),103))

to

SET @Var = (SELECT CONVERT(VARCHAR,Convert(DateTime, GETDATE(), 103),103))
0
 

Author Comment

by:rayluvs
ID: 37793556
It did work.  Question, can this be an issue as I the install parameters of the SQL instance?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37795714
>It did work.
My suggestion?

>Question, can this be an issue as I the install parameters of the SQL instance?
Not sure what you mean.
0
 

Author Comment

by:rayluvs
ID: 37795955
All suggestions worked.

What we mean by "if this can be a SQL instance issue", is since in server SQL 2000 worked excellently and in the 2005 didnt.  So can it be the actual installation?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 400 total points
ID: 37796071
I think it has to do with culture settings.
0
 

Author Comment

by:rayluvs
ID: 37796355
what is "culture"
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 400 total points
ID: 37796413
Regional and culture settings of the system/server. Dates have different format in different cultures like dd/mm/yyyy in UK vs mm/dd/yyyy in US.
0
 

Author Comment

by:rayluvs
ID: 37796450
Understood.

One last question; if truly based on "culture settings", should we reinstall SQL?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 400 total points
ID: 37797073
What are regional settings of the operating systems running the sql servers?

http://stackoverflow.com/questions/2432185/how-can-i-query-the-database-culture-sql-server-2005
0
 

Author Comment

by:rayluvs
ID: 37799543
Thanx, good link.

Should we reinstall SQL or just modify the script as recommended?
0
 

Author Comment

by:rayluvs
ID: 37799546
or change collation?

which?

Please advice.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37802111
Change script is a quick fix. Other fixes would need more investigation. Do you have a DBA?
0
 

Author Comment

by:rayluvs
ID: 37802267
Don't understand by change script and quick script.  We would to just a simple SELECT various time within MsAccess SQL scripting area.

All googles searches has indicated that it not possible so this where we rely on EE expert advice.

No, we don't have a DBA
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37803200
>Don't understand by change script and quick script.  We would to just a simple SELECT various time within MsAccess SQL scripting area

Your question was whether you should change the select statement, reinstall sql, or change collation. My response was that changing the select statement (sql script) is a quick fix if its working. Reinstalling and changing collation is also an option.
0
 

Author Comment

by:rayluvs
ID: 37817359
Thanx
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question