Showing posts with label places. Show all posts
Showing posts with label places. Show all posts

Monday, March 19, 2012

Issues on Decimal Type

Dear All,

The SQL server supports 38-digit deciaml numbers. Is there any known issues, error reported or penalties if all 38 digit places are declared in DECIMAL type columns?

My server version is 2005.

Thanks for all...

Gabriel
All know issues supposed to be fixed. Considering the size, don't use 38 digit wide types unless you have to. Look at bigint datatype, which takes only 8 storage bytes instead of 17 for decimal(38,0)|||

Thanks for your reply.

If I really have to use 38-digit decimal, e.g. decimal(29,9) or decimal(10, 18), will it be any known potential problem?

Friday, February 24, 2012

Issue On Views

I have a view which has a date field. However, this date field is in the form of a number: 20041401. There are also places where the date is 0 (zero). I want to get this date to look like 1/14/04. I did this by creating a view on the first view, and used case to set the 0 (zero) values to null, and then I created another view on the last one to convert the not null values to a date using cast. Is there a simpler way to do what I want? Pretty soon I will lose track of all my views.
Thanks.Maybe you should cast or convert the datetime column the right way in your first view.|||I can't because the date string is in the form of a number. When I execute the view, and it comes across a 0 (zero) I get an error. Because cast can't convert a number to char.|||Not sure I follow..but...

DECLARE @.x int
SELECT @.x = 20041401
SELECT CONVERT(varchar(10),
CONVERT(datetime,SUBSTRING(CONVERT(char(8),@.x),7,2 )
+ '/' + SUBSTRING(CONVERT(char(8),@.x),5,2)
+ '/' + SUBSTRING(CONVERT(char(8),@.x),1,4)),1)|||Originally posted by exdter
I can't because the date string is in the form of a number. When I execute the view, and it comes across a 0 (zero) I get an error. Because cast can't convert a number to char.

Really?

SELECT CONVERT(varchar(10),0)|||That's what I need. Thanks.|||I strongly agree with the notion that, if you're dealing with date-type information that hasn't been stored as a Date field (and which, e.g. for application compatibility reasons, can't be converted now), it is highly desirable that you should use a base view that Casts the value to a date; then base other views on that.|||And doen't that make it an non-updateable view?|||Thanks.