Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)

  • RE: LEFT OUTER JOIN Teaser

    Doing what Andy did, I first got:

    Server: Msg 209, Level 16, State 1, Line 1

    Ambiguous column name 'Val'.

    Server: Msg 209, Level 16, State 1, Line 1

    Ambiguous column name 'Val'.

    Then changed this:

    SELECT...

  • RE: Passing a resultset from one SP to another

    Try this:

    drop procedure dbo.ClntExport

    go

    create procedure dbo.ClntExport (@par1 varchar(50)) as

       --do some stuff

       select 'The parameter is: ' as MyDesc,@par1 as MyPar union

       select 'Dummy record is : ','Dummy'

    go

    drop procedure dbo.ClntImport

    go

    create...

  • RE: How can I determine which column contains a particular value?

    You would have to Cut-n-paste a lot, but maybe this helps:

    create table #t1 (pk_id int,col1 varchar(5), col2 varchar(5), col3 varchar(5))

    create table #t2 (pk_id int,col1 int, col2 int, col3 int)

    insert #t1...

  • RE: update a table with consequtive integers

    3RD time lucky

    declare @v1 int

    set @v1 = 105000

    update a

    set @v1 = @v1+1,

        a.attribute_id = @v1

    from YourTable a

    where isnull(a.attribute_id,0) = 0

     

  • RE: update a table with consequtive integers

    Sorry !!

    where isnull(a.attribute_id,0) = 0

  • RE: update a table with consequtive integers

    What about:

    declare @v1 int

    set @v1 = 105002

    update a

    set a.attribute_id = @v1 = @v1+1

    from YourTable a

    where isnull(a.Prop_ID,0) = 0

     

     

  • RE: IN and parameter query

    Try using charindex() eg:

    declare @v1 varchar(100)

    set @v1 = '1,2,3,4,5' --your incoming list

    set @v1 = ','+@v1+','

    select * from YourTable where charindex(','+YourField+',',@v1) > 0

     

     

  • RE: Selecting the latest records, GROUP BY

    Hi,

    Veteran might have overlooked something. Try:

    SELECT A.Dept_ID, 

     A.Dept_Name,

     A.Date_Stamp

    FROM Departments A

    WHERE A.Date_Stamp = (SELECT MAX(Date_Stamp)

       FROM Departments B

       WHERE A.Dept_ID = B.Dept_ID)

     AND

     A.Time_Stamp = (SELECT MAX(Time_Stamp)

       FROM Departments C

       WHERE A.Dept_ID = C.Dept_ID AND

        A.Date_Stamp = C.Date_Stamp)

     

  • RE: USING A DYNAMIC VARIABLE

    Use a SP with "output" ?

    drop table ##employee

    go

    select 'AA' as code,123 as employee_id into ##employee

    go

    drop procedure p1

    go

    create procedure p1 @Code varchar(10),@@employee_id int output as

     SELECT @@employee_id = employee_id

     FROM ##employee

     WHERE code =...

Viewing 9 posts - 1 through 9 (of 9 total)