Forum Replies Created

Viewing 15 posts - 76 through 90 (of 683 total)

  • RE: Removing duplicates and SUMming columns from a SQL Server 2000 View

    The data section is just for this example. You only need the calculation section to work with your actual data.

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Need to remove duplicate records and get distinct values

    Here are a few ways...

    select a, min(b) as b from [Table 1] group by a

    select a, max(b) as b from [Table 1] group by a

    ; with x as (select *,...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: I cannot select distinct when I inner join to other tables.

    Try replacing

    select

    Log#,

    TextID,with...

    select distinct Log#,

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Triger Help

    Here are some links which might help...

    http://www.nigelrivett.net/SQLTriggers/AuditTrailTrigger.html

    http://www.nigelrivett.net/SQLTriggers/Triggers_2_Creating_Audit_Trails.html

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Triger Help

    Bare with you?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: remove spaces more than double

    Another technique which can be useful in some circumstances...

    update #TEST set Descr = replace(replace(replace(Descr, ' ', '¬ '), ' ¬', ''), '¬', '') where Descr like '% %'

    (Where ¬...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Removing duplicates and SUMming columns from a SQL Server 2000 View

    Hopefully this will get you started...

    --data

    declare @t table (JOB_ID int, JOB_NAME varchar(10), [?] int, SIZE int, run int, SHEETS int,

    QTY int, job_status int, mc int, pages...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: coalesce negative values

    This looks like fun, so I'm chipping in...

    declare @t table (id int identity(1, 1), a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int,...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: update?

    Something like...

    update movie

    set price = case when movieName = 'fofo' then 12000*2 when movieName = 'lili' then 25000/2 end

    where movieName in ('fofo', 'lili')

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Return date for every sunday between years

    Peso (5/23/2008)


    Why count every date from Tally table when every 7th will do?

    set statistics io on

    -- Ryan

    select Date from (select dateadd(d, Number-1, '20080106') as Date from dbo.Tally) a

    where datename(weekday, Date)...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Return date for every sunday between years

    select Date from (select dateadd(d, N-1, '20080106') as Date from dbo.Tally) a

    where datename(weekday, Date) = 'Sunday' and Date <= '20100103'

    See this article for info on how to create the Tally...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: XML vs Split for parsing of URL type data

    Another XML-style approach...

    drop table #Results

    ; with a as (select RowNum, cast('<parm '+ replace(replace(Parameters,'=','="'),'&','" ')+ '"/>' as xml) as Xml from #SourceTable)

    select RowNum,

    Xml.value('(parm[1]/@Subject)[1]', 'varchar(255)') as Subject,

    ...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: walking up the tree - interesting scenario

    Glad to help, thanks for the feedback 🙂

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Returning Data from Stored Proc

    Todd Carrier (5/19/2008)


    Cursor datatype, huh? Does somebody have any sample code to demonstrate? I've never used it before...

    Microsoft does... http://msdn.microsoft.com/en-us/library/ms175498.aspx

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: getdate() accuracy

    rbarryyoung (5/18/2008)


    yeah, I can't figure out why though. I've got the right address in the IFcode, but somehow its coming out with this rogue pointer.

    Here's what I put in:

    [font="Times...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

Viewing 15 posts - 76 through 90 (of 683 total)