Forum Replies Created

Viewing 15 posts - 7,876 through 7,890 (of 14,953 total)

  • RE: Is there a way to intersperse columns of joined tables with the same fields?

    Add in some nullifs, and it becomes blindingly obvious where the differences are. Try this:

    create table #T1 (

    ID int identity primary key,

    Col1 varchar(10),

    Col2 varchar(10),

    Col3 varchar(10));

    create table #T2 (

    ID int...

    - 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: Is there a way to intersperse columns of joined tables with the same fields?

    I don't know an automatic way to do it, but here's a solution I've used:

    select 'tbl1.' + name + ',' as col, name

    from sys.columns

    where object_id = 50

    union all

    select 'tbl2.' +...

    - 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: Inspiring Change

    Steve Jones - Editor (11/5/2009)


    That's an interesting view. I wonder, though, if it's the message to send. Plenty of people in other professions, doctors, lawyers, engineers, architects, etc. work weekends...

    - 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: Cascading DELETE?

    If you look under Create Table in Books Online, you'll find the syntax for creating a column constraint.

    What you're looking for is "References <table> (<column>) on delete cascade".

    Looks like this:

    create...

    - 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: Cannot add or update Activity record because Account Owner does not exist

    Then you'll need to contact the application vendor about the error message.

    - 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: compare values between two tables

    You can also use Except for this. Look up the details in Books Online, but it's pretty easy to use.

    - 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 INT to Datetime

    Try something like this:

    declare @DTInt int, @DTString varchar(20);

    select @DTInt = 23052008;

    select @DTString = cast(@DTInt as varchar(20));

    select cast(stuff(stuff(right(stuff(@DTString, 5, 0, left(@DTString, 2)), 8), 3, 0, '/'), 6, 0, '/') as datetime);

    - 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 trace who does "Truncate table"?

    Run a DML trace on the database. Check out sp_trace_create in BOL.

    - 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: Getting correct results back from variable

    You're welcome. It's usually the simplest things that cause the most confusing problems.

    - 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: Help Needed, Stored Procedure XML to SSIS to Save as XML File

    Can you set up the procs to dump their data into a table with an XML column, then use an Execute task to run the procs, and then the data...

    - 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: Cannot add or update Activity record because Account Owner does not exist

    That's almost certainly a custom error. Is there a trigger on the table they're inserting into?

    - 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: Using OPENROWSET to import CSV files

    What operating system are you running this on? Is it 64-bit? If so, you might need to get a driver for the ODBC connection. Google/Bing 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: Inspiring Change

    For the most part, IT these days has all the appeal and glamor of accounting, or being a file clerk. There's very little real innovation in it, it's more...

    - 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: compatibility level

    Yes, you can modify one of the databases without affecting the others. Easiest way to do it is to go to the Options pannel in the Properties of 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: Multiple Initials

    Something like this maybe?

    select *

    from dbo.MyTable

    where len(initials)>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

Viewing 15 posts - 7,876 through 7,890 (of 14,953 total)