Forum Replies Created

Viewing 15 posts - 271 through 285 (of 355 total)

  • RE: Ltrim rtrim no working with UPDATE

    What do you get if you run this (after changing columns and table names appropriately)?

    SELECT DISTINCT

    [Code] = ASCII(SUBSTRING(LTRIM(columnName), 1, 1)),

    [Character] = '[' + SUBSTRING(LTRIM(columnName), 1, 1) + ']'

    FROM...

  • RE: Ltrim rtrim no working with UPDATE

    Are you sure that 1st character is a normal space (character code 32)?

    declare @s1 char(10), @s2 char(10)

    select @s1 = CHAR(160) + 'WDT' + CHAR(160)

    select @s1, '[' + LTRIM(RTRIM(@s1)) + ']'

    select...

  • RE: ASCII values for GUID

    Is there any other way where I can convert the GUID value in ASP and pass to the SQL Server to insert in the table and by using the same...

  • RE: NOT IN on Null value returns incorrect results

    Doing it this way is slightly more flexible if you want to add more databases to your exclusion list:

    DECLARE @ex_db TABLE (id int)

    INSERT INTO @ex_db

    SELECT db_id('DBA_Audit') UNION ALL

    SELECT db_id('tempdb') UNION...

  • RE: Trouble assigning a variable.

    The following should fix your syntax error:

    select @manufacture = SUM(run_1000) * 1.25 + SUM(make_rdy)

    from tpm_ver_imp_manu_cost m

    inner join tpm_manu_process p

    on (m.process_id = p.process_id)

    where (prod_id = @prod_id)

    and (version...

  • RE: Syntax error converting datetime from character string

    Use an ISO date format for your default maximum date.

    Assuming the desc2 field is a character string that contains a date/time that can be reliably and consistently converted to a...

  • RE: ASCII values for GUID

    My question is why ascii(GUID) values are same for different GUID's in SQL Server 2000. Is there any way where I can avoid this and GUID values are unique.

    The ASCII...

  • RE: Convert Excel Formula to SQL

    This is the line causing the error:

    select @result = ((1+@lf_group1/100)^(12/@lf_exponent)-1)*100

    The ^ character represents the XOR operator in TSQL, not the exponential operator that it represents in VB. In TSQL, you...

  • RE: Working with the Cross Apply with XML

    I think the problem is in your XPath expressions, not with the CROSS APPLY clause:

    Does this give you what you are expecting?

    SELECT

    ----level

    CAST(x.y.query('../../title[1]/text()') as varchar(255)) ...

  • RE: How to?

    Investigate the UNPIVOT clause in Books Online.

  • RE: Eliminate the duplicates

    Here are 2 different ways. Both use the table variable @monthMap

    The 2nd method is pretty much the same as Milla's

    declare @monthMap TABLE (

    id int NOT NULL,

    code char(8) NOT NULL

    )

    INSERT @monthMap...

  • RE: Split a date-range into periods

    I'm not sure that this is precisely what you want, but if not you should be able to tweak it for your needs.

    DECLARE @beginDate datetime

    DECLARE @endDate datetime

    SELECT @beginDate = '2009-02-01',...

  • RE: Split a date-range into periods

    rncruz,

    Does your Events table specify the time as well as the date of the start and end of your events, or is the time portion zero, e.g. '2009-02-03 00:00:00'?

    Likewise for...

  • RE: SQL to calculate number of working days (inc Sat)

    What about national holidays?

    If you need to take account of these then a Calendar table where working days can be identified would be the way to go.

  • RE: convert vb script to sql

    This UDF should do the same as your VBScript.

    It is written for integers of type bigint, but will also work with integers of type int.

    I have used a WHILE...

Viewing 15 posts - 271 through 285 (of 355 total)