Forum Replies Created

Viewing 15 posts - 13,921 through 13,935 (of 14,953 total)

  • RE: Create constant for use in T-SQL

    Separate table per constant type is the way I go on this.

    - 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: 0xA3 when is it L and when L

    Have you tried using the char value?

    select *

    from table

    where column like '%' + char(0xA3) + '%'

    I just tried this:

    create table #Test (

    ID int identity primary key,

    Val char(1))

    insert into #test (val)

    select...

    - 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: Can't find a word in a string

    When you want to use a variable in a Like statement, use this:

    where Column like '%' + @variable + '%'

    Otherwise, the way you wrote it, it's looking for the string-literal...

    - 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: The T-SQL Quiz

    Late to the game, but here's what I came up with for least common multiple:

    declare @N1 int, @N2 int

    select @n1 = 1513, @n2 = 52

    ;with

    N1 (N1Multiple) as

    (select @n1 *...

    - 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: Copy data from a flat file to a temporary table

    I just tried that script, and it seems to work for me. Maybe you need to use Execute 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: Primary key vs NOT NULL unique key..

    RonKyle (5/1/2008)


    In the example above, the four tables I showed with a natural key have 3, 17, 12 and 9 rows respectively. When I got here a year ago, the...

    - 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 constant for use in T-SQL

    I agree with Grant. Store them in a table and join to it.

    UDF in Where will slow your code down. Even if it's by a small amount, it's...

    - 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: Identity field jumps large blocks of values with new records

    I doubt it's something specific to Access on top of SQL. I administered an Access app on top of SQL Server for 6 years, and the only time identity...

    - 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: Primary key vs NOT NULL unique key..

    Prefer numeric keys over text keys.

    I have listened to many arguments in support of that rule. I remain unconvinced.

    The only reason I can think of for this is that numeric...

    - 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: Primary key vs NOT NULL unique key..

    There also seems to be this idea floating about that if one finds an exception to a rule, then the rule is no good.

    Bloody hell!

    The idea that rules with exceptions...

    - 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: Copy data from a flat file to a temporary table

    It depends on what you're copying and what front-end you have on the database.

    For example, in MS Access, which can be used as a front end for SQL Server databases,...

    - 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: Date Function

    select dateadd(day, YourDayValue-1, dateadd(month, YourMonthValue-1, dateadd(year, YourYearValue-1900, 0)))

    or

    select cast(cast(YourMonthValue as varchar(2)) + '/' + cast(YourDayValue as varchar(2)) + '/' +

    cast(YourYearValue as char(4)) as datetime)

    or

    select cast(cast(YourYearValue as char(4)) + right('00' +...

    - 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: money Data type

    I just tested this:

    create table #Test (

    ID int identity primary key,

    Cash money,

    DecCash decimal(15,5))

    insert into #test(cash, deccash)

    select cast(n1.number as money) + cast(n2.number as money)/100.00,

    cast(n1.number as decimal(15,5)) + cast(n2.number as decimal(15,5))/100.00

    from...

    - 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: Table design

    Can you have a table with columns for each of the characteristics you need, and leave some of them null, and have a type column in that table, and some...

    - 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: Primary key vs NOT NULL unique key..

    Tomm Carr (4/29/2008)


    GSquared (4/29/2008)


    The only reason I mention SSN as a problem is because SO many people think "oh, that's perfect!", and use it as a primary or unique key,...

    - 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,921 through 13,935 (of 14,953 total)