RE: REVERSE FUNCTION

RE: REVERSE FUNCTION

 

  

Oops, sorry about that.
So use len and charindex instead.


-----Original Message-----
From: Albert van Biljon
[mailto:mssqldba-ezmlmshield-x61620653.[Email address protected]
Sent: Thursday, July 29, 2004 12:25 AM
To: LazyDBA Discussion
Subject: RE: REVERSE FUNCTION


length and instr aren't valid SQL functions.

--- Chris Hagemaier
<mssqldba-ezmlmshield-x57241040.[Email address protected] wrote:

> Does this work?
> x=length(cast(@test as varchar(25)))-instr(cast(@test as
> varchar(25)),'.')
>
>
>
> -----Original Message-----
> From: Thomas Anthony
> [mailto:mssqldba-ezmlmshield-x71102615.[Email address protected]
> Sent: Wednesday, July 28, 2004 2:50 PM
> To: LazyDBA Discussion
> Subject: RE: REVERSE FUNCTION
>
>
> Why would you do that? IT'S A FLOAT! The question might be valid if
> you
> where talking about a DECIMAL or NUMERIC but, by definition, a float
> is an
> imprecise number as far as the number of decimal places.
>
> Regardless, INFORMATION_SCHEMA.COLUMNS.NUMERIC_SCALE will tell you
> exactly
> how many decimals are being tracked, but that is in conjunction with
> the
> Mantissa. You do the math.
>
> Sincerely,
>
>
> Anthony Thomas, MCDBA, MCSA
>
>
> -----Original Message-----
> From: Parthasarathy Mandayam
> [mailto:mssqldba-ezmlmshield-x17006976.[Email address protected]
> Sent: Wednesday, July 28, 2004 9:31 AM
> To: LazyDBA Discussion
> Subject: RE: REVERSE FUNCTION
>
>
> You need to declare the number using varchar and then reverse it.
>
>
> DECLARE @TEST1 varchar(15)
>
> SELECT @TEST1 = 5638123.025
>
> SELECT prec=charindex('.',reverse(@TEST1))-1
>
>
> Regards
>
> Partha Mandayam
> Software Consultant
> Home page: http://partha.tripod.com
>
>
>
>
>
>
>
> >From: "Jason Volpe "
> ><mssqldba-ezmlmshield-x71674155.[Email address protected]
> >To: "LazyDBA Discussion" <[Email address protected]
> >Subject: REVERSE FUNCTION
> >Date: Mon, 26 Jul 2004 12:17:24 -0700
> >Received: from www.websitesondatabases.com ([216.55.183.38]) by
> >mc4-f41.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Mon, 26
> Jul 2004
> >12:17:58 -0700
> >Received: (qmail 25804 invoked by uid 121); 26 Jul 2004 19:17:02
> -0000
> >Received: (qmail 28355 invoked from network); 26 Jul 2004 19:17:2
> -0000
> >X-Message-Info: JGTYoYF78jHqxCLOcGSmIWHjr3YVVbU5
> >Mailing-List: contact mssqldba-[Email address protected] run by
> ezmlm
> >Precedence: bulk
> >X-No-Archive: yes
> >List-Post: <mailto:[Email address protected]
> >List-Help: <mailto:mssqldba-[Email address protected]
> >List-Unsubscribe: <mailto:mssqldba-[Email address protected]
> >List-Subscribe: <mailto:mssqldba-[Email address protected]
> >Delivered-To: mailing list [Email address protected]
> >Message-ID: <20040726191702.25802.[Email address protected]
> >Return-Path: mssqldba-return-7276-MCP111=hotmail.[Email address
> protected]
> >X-OriginalArrivalTime: 26 Jul 2004 19:17:58.0213 (UTC)
> >FILETIME=[42B23750:01C47345]
> >
> >I am trying to get the len of the decimal places in a float(25)
> number,
> >and
> >
> >getting funky results. Thinking the number is too large for float
> but
> >doesn't
> >
> >make total sense. Any ideas? Was reversing it so I have the
> decimals
> >in
> >
> >the front, and then using len on that, but think its not possible to
> do
> >what im
> >
> >trying to do.
> >
> >
> >
> >DECLARE @TEST1 FLOAT(25)
> >
> >SELECT @TEST1 = 5638123.025
> >
> >SELECT @TEST1
> >
> >SELECT REVERSE (@TEST1)
> >
> >
> >
> >Jason Volpe
> >Information Systems Management
> >intesource Powering Procurement, Advancing Business
> >office: 602-445-2291
> >mobile: 480-452-7269
> >
> >
> >
> >
> >
> >
> >
>
>---------------------------------------------------------------------
> >TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> >Website : http://www.LazyDBA.com
> >To unsubscribe: http://www.lazydba.com/unsubscribe.html
> >For additional commands, e-mail: mssqldba-[Email address protected]
> >
>
>
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
> For additional commands, e-mail: mssqldba-[Email address protected]
>
>
>
>
>
***********************************************************************
> NOTICE: This electronic mail message and any attached files are
> confidential. The information is exclusively for the use of the
> individual or entity intended as the recipient. If you are not the
> intended recipient, any use, copying, printing, reviewing, retention,
> disclosure, distribution or forwarding of the message or any attached
> file is not authorized and is strictly prohibited. If you have
> received
> this electronic mail message in error, please advise the sender by
> reply
> electronic mail immediately and permanently delete the original
> transmission, any attachments and any copies of this message from
> your
> computer system.
>
***********************************************************************
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
> For additional commands, e-mail: mssqldba-[Email address protected]
>
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
> For additional commands, e-mail: mssqldba-[Email address protected]
>
>



---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]


MS Sql Server LazyDBA home page