Forum Replies Created

Viewing 15 posts - 3,721 through 3,735 (of 14,953 total)

  • RE: SARGABLE way of getting orders from exactly 10 days ago

    select (columns needed)

    from Table

    where DateColumn >= cast(dateadd(day, -10, getdate()) as Date)

    and DateColumn < cast(dateadd(day, -9, getdate()) as Date);

    - 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: Database can't be recovered? Any help would be appreciated!!!

    Have you tried the create database options that rebuild the log file?

    Create Database For Attach_Rebuild_Log

    (Check MSDN or BOL for the full syntax.)

    - 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 Question

    select distinct boxID

    from TableB

    where not exists

    (select *

    from TableB as TB2

    inner join TableC

    on TB2.FileID=TableC.FileID

    where TB2.BoxID = TableB.BoxID);

    If you have...

    - 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 Question

    Per your original post, FileID is the primary key in TableB. You CAN'T have multiple entries in a table for the primary key value.

    So what are you actually looking...

    - 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: Freetext query to get surrounding portion of text

    You can use full text indexing on BLOBs stored in SQL Server. MSDN has instructions on setting it up. You have to include the file extension as a...

    - 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 Question

    You don't need a foreign key to do a query.

    How about something like:

    select *

    from TableB

    where FileID not in (select FileID from TableC);

    - 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: Should I upgrade to 2008 for the MERGE option?

    Might have an impact on the execution plan, but not on the syntax of the command. Would have the same impact on separate commands.

    - 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: Convert XML to relational output

    Can you get what you want via a T-SQL query using XQuery?

    - 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: A Little Interviewing Advice

    opc.three (7/19/2011)


    GSquared (7/19/2011)


    ...truncated...

    If the DB Admin will be doing the actual query tuning himself, that's a different question entirely. But that's not DB Admin. That's "Lead Database Developer"...

    - 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: Should I upgrade to 2008 for the MERGE option?

    Yes, Merge will do what you need. Yes, it has, in my tests, performed at least as well as separate statements, if not better.

    There should be no need 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: What is the best way to store passwords

    Same table vs different table makes no real security difference.

    Naming the column something other than "Password" just makes the database that much harder to maintain and develop against.

    So long as...

    - 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: A Little Interviewing Advice

    TravisDBA (7/17/2011)


    opc.three (7/17/2011)


    TravisDBA (7/17/2011)


    I agree that being able to write decent queries and to read others' code is #2 on the list of talent for System DBA's... it's just a...

    - 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: How to Manage Access to a Read-Only databse?

    I'm pretty sure you can't have a database server exist in two AD domains. Could be wrong about that, since I'm not an AD expert, but I don't think...

    - 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: What is the best way to store passwords

    I'm not sure what the name of a column in a table has to do with preventing SQL injection. That's about access methods in your data access layer.

    - 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: CHARINDEX of varbinary column

    Do you mean something like this?

    DECLARE

    @VB VARBINARY(100) = CAST('This Is My String' AS VARBINARY(100)),

    @Sub VARBINARY(100) = CAST('Is' AS VARBINARY(100));

    SELECT CHARINDEX(@Sub, @VB);

    - 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 - 3,721 through 3,735 (of 14,953 total)