Forum Replies Created

Viewing 15 posts - 2,296 through 2,310 (of 2,458 total)

  • RE: Query Help

    DBA12345 (2/5/2013)


    Thanks alot...I appreciate your help

    NP

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Query Help

    This should do the trick:

    --Setup

    IF OBJECT_ID('tempdb..#t1') IS NOT NULL

    DROP TABLE #t1;

    IF OBJECT_ID('tempdb..#t2') IS NOT NULL

    DROP TABLE #t2;

    CREATE TABLE #t1 ([Server] varchar(10) primary key,

    [Name] varchar(10) NOT NULL,

    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Better Way to Perform this Query

    Jeff Moden (1/10/2013)


    Alan.B (1/10/2013)


    This morning before work for example, after a lot of effort, I finally figured out how to get the Levenshtein Edit Distance between 2 strings without a...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Better Way to Perform this Query

    Greg Snidow (1/11/2013)


    Alan.B

    I came up with this:

    -- strings to compare

    DECLARE@s1 varchar(8000)='diner',

    @s2 varchar(8000)='dinerr';

    DECLARE @ld int=ABS(LEN(@s1)-LEN(@s2));

    IF ((@s1=@s2) OR ((ISNULL(LEN(@s1)*LEN(@s2),0)=0))) BEGIN GOTO LD END;

    DECLARE@minlen int=CASE WHEN LEN(@s1)>LEN(@s2) THEN LEN(@s2) ELSE LEN(@s1) END;

    ;WITH...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Problem in installing sql server 2012

    soni321 (1/10/2013)


    yes it is sql server 2012 developer.i have windows7 home premium.Error says i need windows 7 sp1.now my question is i have home preium window 7 i am able...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Problem in installing sql server 2012

    Based on what you are saying I think you mean SP1 (Service Pack1)... And is this SQL Server 2012 Express?

    You may just need to run Service Pack 1.

    What...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Problem in installing sql server 2012

    What's the error?

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Better Way to Perform this Query

    Sean Lange (1/10/2013)


    Alan.B (1/10/2013)


    I agree that I should have used a tally table. I've been writing CTE's for counting for awhile and can do so while sleeping. I still fumble...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Better Way to Perform this Query

    Jeff Moden (1/9/2013)


    Alan.B (1/9/2013)


    AndrewSQLDBA (1/9/2013)


    Its worth noting that the following is sargable.

    LIKE '%abc%'

    Did you mean "NOT" SARGable because it sure doesn't look SARGable from here. 😉 And,...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Better Way to Perform this Query

    dwain.c (1/9/2013)


    Alan - That's a very intriguing use of NTILE!

    I would recommend, however that you change the way you construct your asciichar table:

    ;WITH asciichar(n, c) AS (

    SELECT n=64+number, CHAR(64+number)

    FROM [master].dbo.spt_values...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: "USE DATABASE" in stored procedure

    My appologies. In my last post I misread your question. Hopefully what GSquared posted helped.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: "USE DATABASE" in stored procedure

    Danzz (1/9/2013)


    Thanks for all your help..

    1)I am not looking databases_files in the Out put.

    Example:

    DBA_Databasename_Data

    DBA_Databasename_Log

    2)I am looking for "Use Database" in the our put.

    Example:

    USE DBA_Databasename

    AJB:

    3) I used sys.database_files in...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Better Way to Perform this Query

    AndrewSQLDBA (1/9/2013)


    Hello Everyone

    I hope that everyone is having a very good day.

    I need to write a query to select row counts, but this seems like a lot of scanning of...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: "USE DATABASE" in stored procedure

    Danzz (1/9/2013)


    Thanks for your reply Alan

    I tried couple of ways, It did not work out

    create table ##permission_info (id int primary key identity, information varchar(8000))

    insert...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Question about Optional Parameters in Stored Procedures

    Jacob Pressures (1/9/2013)


    Ok thanks for the info. Right now I'm trying to avoid D-SQL until i learn more about it.

    The TVP seems, at least in my head, like an alternative...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 2,296 through 2,310 (of 2,458 total)