Forum Replies Created

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

  • RE: Appending info to the output of a column

    hoo-t's reply is the best way to do it for a result set. 

    However, If you want it as a single continuous result, then try this:-

    --create test table and populate...

  • RE: Query question...

    Or something like this :- Which does away with the extra join and the group by

    SELECT p.EmployeeID, p.LastName, p.FirstName, p.UpdDate

    FROM Personnel p

    where p.UpdDate=(Select max(Upddate) from Personnel x where p.EmployeeID = x.EmployeeID)

  • RE: Random Record & NewID()

    The order by forces SQL Server to create a temptable. If your column NEWID is unique and incremental, why don't you generate a random number within it's range,pass it...

  • RE: help with stored procedure

    One other way to write this sort of query - which I find to be a very useful technique is :-

    CREATE PROCEDURE au_info @lastname varchar(40), @firstname varchar(20) AS

    SELECT au_lname,...

  • RE: Displaying Query Data Using Variable

    Why don't you compile the Sql and then exec it into a temp table - do your cursor select against the temp table - run the cursor. Then truncate...

  • RE: Displaying Query Data Using Variable

    It depends on the purpose of your SQL, but, why don't you consider writing a View that unions all the data from the similarly structured tables - you can then...

  • RE: Generate Column headers from Variables

    A bit of a bodge, I know, but you could do :-

    declare @header varchar(50)

    set @header = 'TestColumn'

    select @header

    union

    select convert(varchar(10),1)

    order by 1 desc

    It would mean that you'd have to do converts...

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