Forum Replies Created

Viewing 15 posts - 1,651 through 1,665 (of 1,957 total)

  • RE: Case statement

    select DESCRIPTION from CIRC.TAG

    Where Rownum <= 10

    AND @ReportParameter1='apple'

    UNION ALL

    select DESCRIPTION from CIRC.TAG

    WHERE @ReportParameter1='bat'

    UNION ALL

    SELECT NULL

    WHERE @ReportParameter1 NOT IN ('bat'...

  • RE: Disconnected Recordsets - Where are they Stored

    SeanBarberPro (1/7/2011)


    Hello,

    I have a question about Disconnected Recordsets that i havent been able to find much information on.

    When the disconnected record set is created on a SQL server where...

  • RE: Query converted into Dynamic SQL string within Stored Proc yields syntax error

    jabberpunch (1/7/2011)


    I've created a stored procedure that executes a dynamically generated query string based on a single input parameter. The resulting data looks something like this:

    emp_id display_name

    1 ...

  • RE: grouping and ordering by datetime

    create table #test(person varchar(50),dated smalldatetime);

    insert #test

    values('Mr. ADAMS ','2011-01-07 17:00:00')

    ,('Mr. BEACH ','2011-01-07 16:30:00')

    ,('Mr. BEACH ','2011-01-07 16:00:00')

    ,('Mr. SCHAL ','2011-01-07 15:30:00')

    ,('Mr. ADAMS ','2011-01-07 15:00:00')

    ,('Mr. SCHAL ','2011-01-07 14:30:00')

    ,('Mr. JONES ','2011-01-07 14:00:00')

    ,('Mr. BEACH ','2011-01-07 13:00:00')

    select...

  • RE: Why execution plan change because of date format

    Does the same thing happen if you use exactly the same date and time for both queries?

  • RE: Number of weeks between two dates

    Rem70Rem (1/6/2011)


    This seems to be a good approach, but some year have 52 weeks when some other have 53.

    Yes, you would have to deal with that manually when populating the...

  • RE: SQL Agent Job Step Run As

    I don't have 2005 available right now, but this should work I think...

    You create a credential first, then create an agent proxy that will use that credential.

    Once these are...

  • RE: Number of weeks between two dates

    Add a new column to your table e.g. RollingWeek smallint

    update yourTable set RollingWeek=FinWeek where FinYear=2010

    update yourTable set RollingWeek=FinWeek + 52 where FinYear=2011

    update yourTable set RollingWeek=FinWeek + 105 where FinYear=2012

    etc etc...

  • RE: Number of weeks between two dates

    Does this help?

    Basically, the idea is to have another column that counts the weeks between two dates.

    --= test data

    DECLARE @t table(theDate smalldatetime, FinYear smallint, FinPer tinyint, FinWeek tinyint) ;

    set...

  • RE: Replace a certain character in a string but not all

    select REVERSE(STUFF(REVERSE('1, 2, 3, 4'),CHARINDEX(',',REVERSE('1, 2, 3, 4')),1,'dna '))

    is one way - not a great way - but it is one way....

  • RE: Upper/lower case text

    sc-w (1/5/2011)


    That was just what i needed.

    Thanks for all the help, one more quick thing. Those big functions what senario would you use those in?

    Thanks again

    They are useful...

  • RE: Parse Values from XML to Insert into Table

    create procedure sproc_temp(@xml xml)

    as

    begin

    create table #b (ID INT)

    insert into #b(ID)

    SELECT n.value('.[1]','int') as ID

    from @xml.nodes('//@ID') as a(n)

    select * from #b

    end

  • RE: linked server within if statement

    I don't know for sure but it seems like SQL server is trying to connect to the linked server before it runs the query.

    IF you enclose the call to the...

  • RE: UPDATE vs SELECT statements produce diff row stats with same conditions

    CELKO (1/4/2011)


    It would also help if your data elements kept the same name from table to table and you followed ISO-11179 rules. For example, a table is a set so...

  • RE: SQL to find duplicates

    Sort of pseudo code - with guessed table/column names...

    ;with grouped_addresses as

    (

    select name,address1,address2,address3,sum(1) over(partition by address1 [,address2] [,address3]) as dupe_count

    from addresses

    )

    select name,address1,address2,address3

    from grouped_addresses

    where dupe_count>1

    If you really only care about address1, just...

Viewing 15 posts - 1,651 through 1,665 (of 1,957 total)