Forum Replies Created

Viewing 15 posts - 61 through 75 (of 95 total)

  • RE: Check for Existence before delete (Set Based Delete)

    first

    EXISTS (SELECT * FROM tablename WITH (NOLOCK) where day = @day)

    this just allows for dirty reads as a select statement won't interfere with other select statements.

    second

    here's the extremes of what...

  • RE: Conversion failed because the data value overflowed the data type used by the provider.

    the DB doesn't actually 'store' the data like dd/mm/year. Usually it's a 32/64bit integer based from some starting date counting x units of time forward. It's possible that when you...

  • RE: Selecting Results based on A SUM result

    ...I wonder what advantage you see in using "Sum(1)" rather than "Count(*)" in your query. Is there any performance benefit?

    I just ran

    declare @date datetime

    declare @date2 datetime

    set @date...

  • RE: select GUID -> numeric value out of range

    Are you sure that rs.getString(i) on the guid column is causing it? I guess I mean, is there another layer of abstraction between you and the DB where it may...

  • RE: Query on Active/Inactive history table

    something like this?

    table t(accountid, active, [datetime])

    select *

    from t

    where accountid = 1010100

    and datetime between startdate and dateadd(ms, 86399997, enddate)

    order by [datetime]

    this would return all active/inactive events during a date range...

  • RE: Calculating a Percentage

    How can I do the calculations? And please give me the format, just don't say convert.

    FYI, google treats me well for this kind of stuff. eg. If I went...

  • RE: compare 6 month old data between 2 tables

    would something like this work?

    select * from Table2 as b

    where (b.datefield) <= convert(datetime, convert(varchar,getdate(),101) + ' 23:59:59.997'))

    as it wouldn't be running a...

  • RE: Query using SUM and MAX()

    [...I want it to tell me that person p0000001234 gave at least $1000 by 10/1/2007. That's when they would be eligible for a particular donor award. Thank you so much...

  • RE: Catch 22 FK constraint for delete

    We have a depricated product that had entries on it's table. The customer had users tied to the table. When reavtivating the customer (they were using our product 5 years...

  • RE: Optimizing an index for select count(distinct)

    what is a 'visits_id'? It seems that the 'distinct' is what's hosing the computation. checking for duplicates accress 1mil rows is a lot of checking. Is that what the hash...

  • RE: pk naming conventions - is this wrong

    no one was saying anything, so I replied 😛

    Somewhere on this site is a nice Article on 'Must have Rules' for DBs, which includes pk/fk...

  • RE: pk naming conventions - is this wrong

    It sounds about right

    Table1(

    pkid

    fkTable2ID

    fkTable3ID

    )

    or simular to that. I've seen tables with table1.id table1.schoolid table1.number table1.entityid

    i mean, wtf... really. Turned out that id was the true id, but schoolid could stay...

  • RE: Numeric vss Bigint

    From what I understand, numeric is calculated as base 10, so it's emulated. bigint/int are actual native binary value types. Simular to the difference between a string and a char.

    make...

  • RE: SELECT * INTO temp table

    when you do a (select * into #table), doesn't it lock the tempdb the entire time of the select staments because the tempdb is locked during the creation of a...

  • RE: random Number

    I had some simple issue with converting newid() to a varchar. This could work

    select convert(bigint,HashBytes('SHA1', convert(varchar(255), newid())))

    and if you're paranoid

    select convert(bigint,HashBytes('SHA1', convert(varchar(255), newid())+convert(varchar, getdate(),121) ))

Viewing 15 posts - 61 through 75 (of 95 total)