Forum Replies Created

Viewing 15 posts - 91 through 105 (of 156 total)

  • RE: Validating a numeric within SUM on a VarChar field

    CREATE TABLE #t (V varchar(5))

    INSERT INTO #t VALUES ('10')

    INSERT INTO #t VALUES ('20')

    INSERT INTO #t VALUES ('30')

    INSERT INTO #t VALUES ('A10')

    INSERT INTO #t VALUES ('0D830')

    SELECT V, ISNUMERIC(V) IsItNumeric FROM #t

    --...

  • RE: Convert!

    select ProductID,ProductName,SupplierID,

    CASE WHEN ProductID < 11 THEN 'P' + CONVERT(varchar(2),ProductID)

     ELSE 'PN'

    END As NewP

    FROM Northwind.dbo.Products

  • RE: cannot view the model, msdb, tempdb and model database

    Right click on the Server in Enterprise Manager and select 'Edit SQL Server Registration Properties'. See if the Show system databases and system objects is unchecked. Check it to see...

  • RE: Using 2 or more "NOT IN" statements

    DECLARE  @tblNumbers TABLE (ID int)

    INSERT INTO @tblNumbers VALUES (1)

    INSERT INTO @tblNumbers VALUES (2)

    INSERT INTO @tblNumbers VALUES (3)

    INSERT INTO @tblNumbers VALUES (4)

    INSERT INTO @tblNumbers VALUES (5)

    INSERT INTO @tblNumbers VALUES (6)

    DECLARE  @tblNumA...

  • RE: Hierachy Sort (with a twist)

    Wow. That query really rocks. I thought I would need to call a function in the Order By clause. Thanks a bunch.

    Currently the table goes to 8 levels down. I...

  • RE: Hierachy Sort (with a twist)

    The first "sort" is done on Node. The first row is a Level 1. From the sample data, 20433 is a child of 7264 and 40264 is a child of 20433.

    If...

  • RE: Hierachy Sort (with a twist)

    Oops. Here is the revised desired output.

    Node

    Level

    LastChildID

  • RE: Table Variable with Identity Column

    SET NOCOUNT ON

    DECLARE @tbl TABLE (RowID INT IDENTITY, descr varchar(10) )

    insert into @tbl

    SELECT 'a'

    UNION

    select 'b'

    UNION

    select 'c'

    UNION

    select 'd'

    UNION

    select 'e'

    SELECT * FROM @tbl

    DBCC CHECKIDENT('@tbl',NORESEED)

    Error : Could not find a table or...

  • RE: Slef Join Loop

    Yelena,

    Your query returns Null. I changed the query but still can go up 1 row only.

    CREATE TABLE #Test (ID int, LocationID varchar(20), DeletedFlag bit, LinkID int)

    INSERT INTO #Test VALUES...

  • RE: Tree Sort

    Noeld, thanks for your input. But this still does not give me the result I expect.

     

  • RE: Tree Sort

    First compare 'a;b;a5' and 'a;b;a3' Both have 3 items but the type of material is 'B' for the first one ('a;b;a5' ) and 'C' for the second ('a;b;a3' ). So...

  • RE: Tree Sort

    Both are level 3 (3 items) and both have type of material as B.

    Description 'Desc aca' comes before 'Desc acd' so 'a;b;a5'  comes before 'a;b;a3'

  • RE: Result from 2 tables with no link

    Instead of running 2 queries from .Net, make one trip to the server to get the data.

    Thanks PW, it worked.

  • RE: Result from 2 tables with no link

    This query does not return any rows.

    USE Pubs

    Go

    SELECT au_lname, au_fname, employee.fname, employee.lname

    FROM authors, employee

    WHERE authors.au_id = '472-27-2349'

    AND employee.emp_id = 'ZZZZZZZZ'

    what I would like to return is  

    Gringlesby Burt Null Null

    Is this...

  • RE: Result from 2 tables with no link

    But this will not return any result if TableB has no row with ID=2 and TableA has row with ID =1

    I would still like to return all rows from TableA...

Viewing 15 posts - 91 through 105 (of 156 total)