Forum Replies Created

Viewing 15 posts - 10,096 through 10,110 (of 14,953 total)

  • RE: Challenging SQL interview questions

    Jeff Moden (4/7/2009)


    The 2nd question has nothing to do with SQL, either. It's about a "tabular file".

    Though you could certainly accomplish the desired end-result through T-SQL. Either import...

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

    donato1026 (4/7/2009)


    I wish there was a tool out there that analyzed your queries and syntax and made suggestions on how to improve upon it.

    This page and others like it are...

    - 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: Best way to strip time from datetime stamp.

    Flo: Yep. That's why I use that one. Easy to modify for other uses besides just removing time.

    - 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: Best way to strip time from datetime stamp.

    I just ran tests on this:

    set nocount on;

    if object_id(N'tempdb..#T') is not null

    drop table #T;

    create table #T (

    ID int identity primary key,

    Date datetime,

    CleanedDate datetime);

    insert into #T (Date)

    select top 1000000 dateadd(second, checksum(newid()),...

    - 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: Best way to strip time from datetime stamp.

    The speed tests I've done have found that "dateadd(day, datediff(day, 0, @Date), 0)" has been the fastest.

    The way to test it is to create a table with a million 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

  • RE: Query Performance

    donato1026 (4/7/2009)


    Like I said... Being new at this, I am not sure what the best way is to do this. I just know it runs VERY slow. 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: Returning from my query, which calls a SP

    Try this:

    ALTER PROCEDURE [dbo].[GetDiscount1]

    @Username VARCHAR(255)

    @ret int output

    AS

    SET @ret = (

    SELECT Discount.DiscountAmount

    FROM Discount

    WHERE DiscountCode = dbo.GetUserIdFromUsername(@Username)

    )

    You don't use "declare" in parameters. You need to include "output" after the parameter you want...

    - 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: reporting services

    Please don't double-post in multiple forums.

    - 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: reporting services

    Not only is it possible, it's recommended.

    - 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 can I check if and xml Field is not null or blank in sql sever

    create table #T (

    ID int identity primary key,

    XMLCol XML);

    insert into #T (XMLCol)

    select ' ';

    insert into #T (XMLCol)

    select '';

    insert into #T

    default values;

    select *

    from #T

    where XMLCol is not null and cast(XMLCol 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: Function Hell

    Either one should be pretty darn fast.

    - 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: Huge not performant tabled valued Function

    Yes. This is what's called an "Inline Table Value Function". The prior version was a "Multi-Select Table Value Function". Both are types of "User Defined Functions".

    The difference...

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

    This will give you a list of the databases that have that table:

    declare @sql nvarchar(max);

    select @sql = coalesce(

    @sql + ' union all select ''' + name + ''' as db...

    - 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: SELECT INTO - different server

    I don't believe it's possible to do Select Into across servers.

    - 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: Huge not performant tabled valued Function

    Why would you do a cross join between those two? So far as I can tell, all the joins in the original query had the same two columns in...

    - 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 - 10,096 through 10,110 (of 14,953 total)