Forum Replies Created

Viewing 7 posts - 31 through 37 (of 37 total)

  • RE: how to remove numbers from strings?

    Sergiy (10/17/2007)


    Max Yasnytskyy (10/17/2007)


    Fair enough.

    How would you use LIKE [0-9] without making the query too complicated?

    In your script:

    IF @TmpString NOT LIKE [0-9]

    Not too complicated?

    :hehe:

    Can i have a working example please

    When...

  • RE: how to remove numbers from strings?

    Sergiy (10/17/2007)


    Max Yasnytskyy (10/17/2007)


    Sergiy, if you were reading my post a bit more carefully you would have noticed that it is only integer, floating point number, money or decimal types...

  • RE: how to remove numbers from strings?

    I have found an interesintg function in msdb, seems like it is working much better

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE FUNCTION [dbo].[udfTRANSELATE] (@mixedString AS varchar(max))

    RETURNS varchar(max)

    as

    BEGIN

    DECLARE @resultString varchar(max), @tmpString...

  • RE: how to remove numbers from strings?

    Sergiy, if you were reading my post a bit more carefully you would have noticed that it is only integer, floating point number, money or decimal types are returning 1....

  • RE: how to remove numbers from strings?

    Well spotted

    But because i take a single character at a time '3e5' will never be validated as a whole...

  • RE: how to remove numbers from strings?

    perhaps function like this may help you.

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE FUNCTION [dbo].[udfTRANSELATE] (@mixedString AS varchar(max))

    RETURNS varchar(max)

    as

    BEGIN

    DECLARE @resultString varchar(max), @tmpString char(1), @i int, @strLen int

    SELECT @resultString='', @i=0, @strLen=len(@mixedString)

    WHILE...

  • RE: Using a declared field in stored procedures to name a table

    i would do it like this

    DECLARE @tableName AS varchar (50), @sqlCmd varchar(max)

    SELECT @tableName=nameOfTable

    FROM

      WHERE tabledisc = 1

      SELECT @sqlCmd='SELECT * FROM '+@tableName

      EXEC sp_executesql @sqlCmd

      dynamic SQL...

    Viewing 7 posts - 31 through 37 (of 37 total)