Forum Replies Created

Viewing 15 posts - 9,676 through 9,690 (of 10,144 total)

  • RE: Sorting value in a column

    Christopher Stobbs (8/7/2008)


    HI Chris,

    I copied your code straight into a a query window and here are the results I code

    TheValue(No column name)

    132132

    873873

    969969

    Thanks Chris...how odd! I've tested it here several times...

  • RE: Sorting value in a column

    Christopher Stobbs (8/7/2008)


    HI Chris,

    Your solution does not work.

    The TOP 100 PERCENT is messing with your results.

    If you make TOP 100000 then it works

    Interesting...it works with the (albeit limited) set of...

  • RE: Sorting value in a column

    -- Create a function

    CREATE FUNCTION [dbo].[uftSortString]

    (

    @String NVARCHAR(100)

    )

    RETURNS NVARCHAR(100)

    AS

    BEGIN

    DECLARE @ReturnValue NVARCHAR(20)

    SET @ReturnValue = ''

    SELECT @ReturnValue = @ReturnValue + d.TheValue

    FROM (SELECT TOP 100 PERCENT CAST(SUBSTRING(@String,number,1) AS CHAR(1)) AS...

  • RE: Sorting value in a column

    Hello

    You want to sort the data in the string, as opposed to sorting the column.

    So the value '132' becomes '123' etc

    What is the maximum length of string values found in...

  • RE: if-else

    It's still really difficult to tell what's supposed to be happening here because the use of variables doesn't necessarily make any sense. It would help people a great deal if...

  • RE: IF-ELSE Syntax error

    You need a BEGIN / END block between IF and ELSE if the IF is followed by more than one statement.

  • RE: Inserting Top 1 Record

    jeordonez (8/4/2008)


    Gianluca,

    Almost there, unfortunately we are not on SQL 2005 yet so ROW_NUMBER() doesn't work.. :(. is there an equivalent to this for 2000???

    Yep:

    SELECT i.*

    FROM #InventoryStage i

    INNER JOIN (SELECT...

  • RE: Inserting Top 1 Record

    Hi Jeordonez

    A picture tells a thousand words...

    CREATE TABLE #InventoryStage(

    [SerialNumber] [varchar](20) NULL,

    [TagNumber] [varchar](8) NULL,

    ...

  • RE: Date Range - Weeks

    DROP TABLE #Dates

    CREATE TABLE #Dates (CreateDate DATETIME)

    INSERT INTO #Dates (CreateDate)

    SELECT '01/01/2008' UNION ALL

    SELECT '02/01/2008' UNION ALL

    SELECT '03/01/2008' UNION ALL

    SELECT '04/01/2008' UNION ALL

    SELECT '05/01/2008' UNION ALL

    SELECT '06/01/2008' UNION ALL

    SELECT '07/01/2008' UNION...

  • RE: function with alphabet

    You're welcome :unsure::ermm:

  • RE: function with alphabet

    declare @Return varchar(30), @String varchar(30)

    set @Return = ''

    set @String = 'CHARLES H#L6CAL JOEL4'

    SELECT @Return = @Return + SUBSTRING(@String,number,1)

    FROM dbo.Numbers WITH (NOLOCK)

    WHERE number <= LEN(@String)

    AND UPPER(SUBSTRING(@String,number,1)) LIKE '%[^A-Z]%'

    SELECT CASE WHEN...

  • RE: function with alphabet

    How about a little more information? What do you want to do if the string contains something other than a letter? Such as

    report an error

    not import the row into a...

  • RE: insert - help!

    You're welcome Jude, thanks for the feedback 🙂

  • RE: insert - help!

    Test the SELECT on its own:

    SELECT c.academic_year, c.faculty, c.faculty_description, c.department_code,

    c.department_description, c.course_level_code, c.location_of_study, c.location_of_study_description,

    c.franchise_flag, c.source_of_funding_hesa, c.Residential_Status_Code, c.residential_status_description,

    c.Course_Code, c.course_mode_of_study_hesa

    FROM tblStudent_Course c

    INNER JOIN tblNew_Entrants n

    ...

  • RE: insert - help!

    Hi Jude

    Can you please post the code you ran, with the error message?

    Please also post:

    The list of columns you want populated in the registration table

    The list of columns from the...

Viewing 15 posts - 9,676 through 9,690 (of 10,144 total)