Showing posts with label standard. Show all posts
Showing posts with label standard. Show all posts

Thursday, March 29, 2012

Converting Date Data type in stored procedure

HI Experts...

I am using SQL SERVER 2005 standard edition

I have encountered a problem regarding converting date data type in stored procedure

As i was having problem taking date as input parameter in my stored procedure, so, then I changed to varchar (16) i.e.

CREATE PROCEDURE sp_CalendarCreate
@.StDate VARCHAR(16) ,
@.EDate VARCHAR(16),

then I am converting varchar to date with following code

DECLARE @.STARTDATE DATETIME
DECLARE @.ENDDATE
DATETIME

SELECT
@.STARTDATE = CAST(@.STDATE AS DATETIME)
SELECT @.ENDDATE = CAST(@.EDATE AS DATETIME)

When I try to execute the procedure with following code

execute sp_CalendarCreate @.stdate='12-1-06',@.edate='20-1-06'

but it gives me following error

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

Can any one tell me the solution of that problem (at ur earliest)

regards,

Anas

execute sp_CalendarCreate @.stdate='1-12-06',@.edate='1-20-06'

|||

Thanx for your reply....

yes i had sorted that out b4 u replied me... i.e. sql server uses date format mmddyy or yyyyddmm (american format)

and i was using UK/european standards

btw thanx very much for support

regards,

Anas

|||It is best to use ISO unseparated date format (YYYMMDD) or ISO 8601 (YYYY-MM-DDThh:mm:ss.nnn) datetime format for specifying values. This way you don't have to worry about DATEFORMAT or language settings of the server. Also, using varchar and converting to datetime is not a good and clean approach. Use the correct data type for the values so you can get the best benefit in terms of type checking, domain validations etc. Additionally, with your approach you will get into performance problems because parameter sniffing of the variables used in the SELECT statement will not work due to use of local variables and not parameters. See the whitepaper on compilation, caching in MSDN for more details.

Tuesday, March 20, 2012

converting (casting) from decimal(24,4) to decimal(21,4) data type problem

Hello!

I would like to cast (convert) data type decimal(24,4) to

decimal(21,4). I could not do this using standard casting function

CAST(@.variable as decimal(21,4)) or CONVERT(decimal(21,4),@.variable)

because of the following error: "Arithmetic overflow error converting

numeric to data type numeric." Is that because of possible loss of the

value?

Thanks for giving me any advice,

Ziga

What was the value? For a value that fits in both, you should have no issue:

declare @.value decimal(24,4)
set @.value = 10.12

select cast(@.value as decimal(21,4))
go

But if the non-fractional value is too large for the 21,4 datatype, it will go boom:

declare @.value decimal(24,4)
set @.value = 12345678901234567890.1234

select @.value

select cast(@.value as decimal(21,4))

12345678901234567890.1234

Msg 8115, Level 16, State 8, Line 6
Arithmetic overflow error converting numeric to data type numeric.

If this isn't the case, then post the code that fails, the value, and the results of:

select @.@.version

I tried this on the following versions:

Microsoft SQL Server 2000 - 8.00.679 (Intel X86)
Aug 26 2002 15:09:48
Copyright (c) 1988-2000 Microsoft Corporation
Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 4)

Microsoft SQL Server 2005 - 9.00.2153.00 (Intel X86)
May 8 2006 22:41:28
Copyright (c) 1988-2005 Microsoft Corporation
Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

|||Yes the non fraction value is to large... So there is no way to solve this problem?|||What is the result that you expect when you try to cast a larger value? CAST will throw error for overflow and that is the only expected behavior. If you want to fit larger values into smaller data type then you need to truncate the value yourself or perform other logic. You could use CASE expression to check for the larger values and conditionally perform cast. Also, take a look at ROUND function. You could use it instead of CAST for the larger values or for the whole conversion.|||

Thanks!

Actually I am performing some mappings between two systems. Interface for the destination system has specification of the field as decimal(21,4). In source system the (calculated) value is larger - decimal(24,4). For those large values where the cast (to decimal(21,4)) is not possible (arithemtic overflow) performing correct mapping is just not possible...

Thakns a lot,

Ziga

|||You still haven't answered how you would like to handle the larger values. Do you simply throw those away? What would it mean to store a truncated result in the database? And if you use it later then you are going to make wrong assumptions. It seems like your table schema is wrong and if you want to retain the higher precision values you need to modify the schema to match the source or vice versa. Otherwise, you will have to use round or truncate the value yourself before inserting and you cannot use CAST.

Thursday, March 8, 2012

Convert SQL Srv 2000 Enterprise to SQL Srv Standard?

We are running SQL Srv 2000 Enterprise on a production SQL Server but are not
using the Enterprise features and want to conver to SQL Srv 2000 Standard.
Is it possible to "downgrade" without doing a full reinstall of SQL Srv?
I thought that was the answer based on what I have read but was holding out
some hope.
We currently own an Enterprise license but when we renew our yearly
agreement (We have educational pricing from MSFT), we wnat to remove that
license and use just standard.
"Immy" wrote:

> I'm afraid there is no option to downgrade.
> You'd need to backup your databases, uninstall and re-install the SQL
> server.
> Note that there is a cost different between Standard and Enterprise. Not
> sure you can get any refunds back from MS on this, so why don't you just
> keep the Ent. Edition installed if you've already paid for it. You may need
> the features in the future?
> Immy
> "jcs0277" <jcs0277@.discussions.microsoft.com> wrote in message
> news:D88E3328-FCA2-4ED5-B4FF-92BD0538769C@.microsoft.com...
>
>
|||i have a similar issue
i'm thinking of moving to the developer edition
does this move require uninstall then reinstall? is there more difference
between these editions than simply the license agreement?
"jcs0277" wrote:
[vbcol=seagreen]
> I thought that was the answer based on what I have read but was holding out
> some hope.
> We currently own an Enterprise license but when we renew our yearly
> agreement (We have educational pricing from MSFT), we wnat to remove that
> license and use just standard.
> "Immy" wrote:

Convert SQL Srv 2000 Enterprise to SQL Srv Standard?

We are running SQL Srv 2000 Enterprise on a production SQL Server but are no
t
using the Enterprise features and want to conver to SQL Srv 2000 Standard.
Is it possible to "downgrade" without doing a full reinstall of SQL Srv?I'm afraid there is no option to downgrade.
You'd need to backup your databases, uninstall and re-install the SQL
server.
Note that there is a cost different between Standard and Enterprise. Not
sure you can get any refunds back from MS on this, so why don't you just
keep the Ent. Edition installed if you've already paid for it. You may need
the features in the future?
Immy
"jcs0277" <jcs0277@.discussions.microsoft.com> wrote in message
news:D88E3328-FCA2-4ED5-B4FF-92BD0538769C@.microsoft.com...
> We are running SQL Srv 2000 Enterprise on a production SQL Server but are
> not
> using the Enterprise features and want to conver to SQL Srv 2000 Standard.
> Is it possible to "downgrade" without doing a full reinstall of SQL Srv?|||I thought that was the answer based on what I have read but was holding out
some hope.
We currently own an Enterprise license but when we renew our yearly
agreement (We have educational pricing from MSFT), we wnat to remove that
license and use just standard.
"Immy" wrote:

> I'm afraid there is no option to downgrade.
> You'd need to backup your databases, uninstall and re-install the SQL
> server.
> Note that there is a cost different between Standard and Enterprise. Not
> sure you can get any refunds back from MS on this, so why don't you just
> keep the Ent. Edition installed if you've already paid for it. You may nee
d
> the features in the future?
> Immy
> "jcs0277" <jcs0277@.discussions.microsoft.com> wrote in message
> news:D88E3328-FCA2-4ED5-B4FF-92BD0538769C@.microsoft.com...
>
>|||i have a similar issue
i'm thinking of moving to the developer edition
does this move require uninstall then reinstall? is there more difference
between these editions than simply the license agreement?
"jcs0277" wrote:
[vbcol=seagreen]
> I thought that was the answer based on what I have read but was holding ou
t
> some hope.
> We currently own an Enterprise license but when we renew our yearly
> agreement (We have educational pricing from MSFT), we wnat to remove that
> license and use just standard.
> "Immy" wrote:
>

Convert SQL Srv 2000 Enterprise to SQL Srv Standard?

We are running SQL Srv 2000 Enterprise on a production SQL Server but are not
using the Enterprise features and want to conver to SQL Srv 2000 Standard.
Is it possible to "downgrade" without doing a full reinstall of SQL Srv?I'm afraid there is no option to downgrade.
You'd need to backup your databases, uninstall and re-install the SQL
server.
Note that there is a cost different between Standard and Enterprise. Not
sure you can get any refunds back from MS on this, so why don't you just
keep the Ent. Edition installed if you've already paid for it. You may need
the features in the future?
Immy
"jcs0277" <jcs0277@.discussions.microsoft.com> wrote in message
news:D88E3328-FCA2-4ED5-B4FF-92BD0538769C@.microsoft.com...
> We are running SQL Srv 2000 Enterprise on a production SQL Server but are
> not
> using the Enterprise features and want to conver to SQL Srv 2000 Standard.
> Is it possible to "downgrade" without doing a full reinstall of SQL Srv?|||I thought that was the answer based on what I have read but was holding out
some hope.
We currently own an Enterprise license but when we renew our yearly
agreement (We have educational pricing from MSFT), we wnat to remove that
license and use just standard.
"Immy" wrote:
> I'm afraid there is no option to downgrade.
> You'd need to backup your databases, uninstall and re-install the SQL
> server.
> Note that there is a cost different between Standard and Enterprise. Not
> sure you can get any refunds back from MS on this, so why don't you just
> keep the Ent. Edition installed if you've already paid for it. You may need
> the features in the future?
> Immy
> "jcs0277" <jcs0277@.discussions.microsoft.com> wrote in message
> news:D88E3328-FCA2-4ED5-B4FF-92BD0538769C@.microsoft.com...
> > We are running SQL Srv 2000 Enterprise on a production SQL Server but are
> > not
> > using the Enterprise features and want to conver to SQL Srv 2000 Standard.
> > Is it possible to "downgrade" without doing a full reinstall of SQL Srv?
>
>|||i have a similar issue
i'm thinking of moving to the developer edition
does this move require uninstall then reinstall? is there more difference
between these editions than simply the license agreement?
"jcs0277" wrote:
> I thought that was the answer based on what I have read but was holding out
> some hope.
> We currently own an Enterprise license but when we renew our yearly
> agreement (We have educational pricing from MSFT), we wnat to remove that
> license and use just standard.
> "Immy" wrote:
> > I'm afraid there is no option to downgrade.
> > You'd need to backup your databases, uninstall and re-install the SQL
> > server.
> > Note that there is a cost different between Standard and Enterprise. Not
> > sure you can get any refunds back from MS on this, so why don't you just
> > keep the Ent. Edition installed if you've already paid for it. You may need
> > the features in the future?
> > Immy
> >
> > "jcs0277" <jcs0277@.discussions.microsoft.com> wrote in message
> > news:D88E3328-FCA2-4ED5-B4FF-92BD0538769C@.microsoft.com...
> > > We are running SQL Srv 2000 Enterprise on a production SQL Server but are
> > > not
> > > using the Enterprise features and want to conver to SQL Srv 2000 Standard.
> > > Is it possible to "downgrade" without doing a full reinstall of SQL Srv?
> >
> >
> >

Saturday, February 25, 2012

Convert Oracle 8.1.7 database to SQL 2005 sizing estimates

We are planning on converting a Oracle 8.1.7 database to SQL 2005 Standard Edition. How can we calculate the disk space requirements needed to convert the database. Any help is appreciated.

TIA,

Michelle

If it's built and indexed the same way, it will probably be very close to the size of the original Oracle database.

-Ryan / Kardax