Forum Replies Created

Viewing 15 posts - 1,006 through 1,020 (of 1,923 total)

  • RE: Error converting data type nvarchar to numeric

    Chrissy321 (1/26/2011)


    ISNUMERIC(CONVERT(decimal(6,2),Field1)) returns 1 for all fields.

    ISNUMERIC lies 😎 Don't use ISNUMERIC to validate integer values in a Field.

    Use this : LIKE '%0-9%'

  • RE: NULL Values

    You are welcome 🙂

  • RE: NULL Values

    This will do it:

    SELECT Sector, Region, employee_num_tech AS [Technician #],

    ISNULL ( SUM (DATEDIFF(mi,wow_start,wow_end)) ,0) AS [TOTAL MINS], DATEPART(yyyy, date_identified) AS YEAR, DATENAME(mm,date_identified) AS MONTH

    FROM TABLE 1

    I have used the ISNULL...

  • RE: Random ordered groups

    Andy Lucas (1/25/2011)


    Hope this helps.

    One advice (i know people don't like advices, but i will have to tell it out :(), Please do not use a code in LIVE environment...

  • RE: variable in string

    Try this out (the code i added/edited has been wrapped around /* START OF ADDITION */ and /* END OF ADDITION */)

    Declare @CurrID int,@MaxID int

    Declare @DBs Table (DBID...

  • RE: String Concatenation from Update

    :blush: thanks for the feedback Tom!

  • RE: String Concatenation from Update

    I had my mind at sea while using that. A much tweaked version of the UPDATE statement (uses the same logic but with some tweak)

    UPDATE FT

    SET FT.Full_name =

    ...

  • RE: String Concatenation from Update

    How about this ?

    DECLARE @First_Table TABLE

    (

    ID INT,

    Full_name VARCHAR(250)

    )

    INSERT INTO @First_Table (ID)

    SELECT 1 UNION ALL

    SELECT 2 UNION ALL

    SELECT 3

    DECLARE @Second_Table TABLE

    (

    ...

  • RE: Need a Help

    Gianluca Sartori (1/25/2011)


    How fast, Mr. Coffe!

    I may be fast, but u are so precise Sir!! mine will produce an extra hyphen for empty strings, your's wont!! Beautiful!!

    BTW, Happy New Year,Gian!...

  • RE: variable in string

    How about this?

    DECLARE @Command NVARCHAR(MAX)

    DECLARE @DBName NVARCHAR(128)

    SELECT @DBName = DB_NAME()

    SELECT @Command = N'Declare

    @ObjName Varchar(255) ,

    @indexname varchar(255),

    @Dbnames Varchar(255),

    @Db_id varchar(255),

    @Tab_id int,

    @Fragmentation int,@Pages int

    Select @Pages=10000

    Select @Fragmentation=30

    Select @Dbnames = '''+ @DBName+'''

    --set @dbname=''test''

    set @db_id=db_id(@dbname)

    if exists...

  • RE: Need a Help

    How about this ?

    SELECT REPLACE ( (SM_Outer.FORMAT_NAME + ' - ' +

    STUFF ( ( SELECT ' ('+FORMAT_ID + ') '

    ...

  • RE: variable in string

    You cannot concatenate variables in parameters ; concatenate the data as a single variable using this SET @Variable = 'some data' + @DBNAME + 'remaining data' and then pass the...

  • RE: Random ordered groups

    Jeff Moden (1/24/2011)


    ColdCoffee (1/24/2011)


    One advice (i know people don't like advices, but i will have to tell it out ), Please do not use a code in LIVE environment if...

  • RE: T SQL Error Capturing

    Please read about TRY CATCH block from MSDN ONline or Books Online to know about the scenarios where TRY will enter CATCH when an error is encountered. NOT ALL...

  • RE: Random ordered groups

    The below chunk will assign a unique number to each group (here as we are using GROUP BY, we will have unique values from GroupedCol column). NEWID() will produce UNIQUE...

Viewing 15 posts - 1,006 through 1,020 (of 1,923 total)