Forum Replies Created

Viewing 15 posts - 13,261 through 13,275 (of 14,953 total)

  • RE: Updating all stored procedures / functions in a database

    Something like this might work:

    declare Cur cursor local fast_forward for

    select definition

    from sys.sql_modules

    where definition like '%alterdate%'

    declare @sql varchar(max)

    open cur

    fetch next from cur

    into @sql

    select @sql =

    replace(

    replace(@SQL, 'alterdate', 'createdate'),

    'create proc',...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: WHERE clause

    You need to properly nest your Ands and Ors.

    This might do what you need:

    (c.CustomerID = '3942') AND (ol.DetailTableID < '6/17/2008') AND (o.Opendate < '6/19/2008') AND

    ((ol.PLU LIKE 'ONL-ANN%')...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Updating all stored procedures / functions in a database

    That's the only way I know of.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Query using SUM and MAX()

    What you want to do is use a running total, and pick the row where that goes over the desired threshhold.

    There's a good article on running totals at:

    http://www.sqlservercentral.com/articles/Advanced+Querying/61716/

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Sql Native Client ODBC Driver issues

    I've had the "connection timeout expired" happen because of misnaming the server in the connection string. I've also had it happen because the network between the two servers was...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Split text by empty spaces

    Try something like this:

    declare @T varchar(100)

    select @t = 'Mr. John Smith Jones'

    select substring(left(@t, charindex(' ', @t, charindex(' ', @t) + 1)),

    charindex(' ', @t), charindex(' ', @t, charindex(' ', @t) +...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Create Temporary Tables Dynamically in cursor loop

    I don't think you can do what you're trying to do, and, even if you can, you probably shouldn't.

    A cursor that creates an arbitrary number of temp tables with 1...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Continuation of: Execution Plans not the same

    What you posted about or vs and made me take a slightly different tack on this. Try this:

    ;with Main (Contact_WID, Source_WID, Offer_WID) as

    (select chf.contact_wid, chf.source_wid,

    isnull(poh.offer_wid, 0)

    from w_camp_hist_f Chf

    left...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Login Auditing ...

    Probably need to restart the service.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Full Recovery, no tlog growth

    It's also possible that you just aren't filling up the log file. 6 Gig of log is quite a few transactions, even if they are big transactions.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Full Recovery, no tlog growth

    One possibility is you can set a maximum size for the log file. It might be at that, if it's set.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Understanding Transaction Log Files

    I actually ran into a situation where someone didn't want to keep "the audit logs" for the database and deleted all the log files. The reply to "restore to...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Truncate Table generic script

    If you really want to truncate all the tables in a database, you're probably better off using a create script to drop the whole database and rebuild it.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: French accent characters issue

    That's a MySQL version number, not an MS SQL version number. You're probably running on MySQL. Might be better off asking on a page that focuses on that...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Get date of last Sunday of every month

    rbarryyoung (6/18/2008)


    GSquared (6/17/2008)


    ...are all considered deterministic by SQL Server, but

    Datepart(Weekday, date)

    is not.

    Neither are:

    dateadd(day, '12/30/1899', date)%7

    cast(date as float)%7

    cast(date as int)

    Aren't the first two affected by configuration settings on the server or...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 15 posts - 13,261 through 13,275 (of 14,953 total)