Forum Replies Created

Viewing 15 posts - 1,771 through 1,785 (of 8,731 total)

  • RE: t-sql 2012 possible join to same table

    Here's an approach similar to Phil's, but both will fail if the value starts with '0'.

    DECLARE @test1 VARCHAR(10) = '16-17';

    DECLARE @test2 VARCHAR(10) = CAST( LEFT( @test1, 2) - 1 AS...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: trying to get rid of clustered index scan

    EdVassie (12/7/2016)


    As already said, the DDL and plan is really needed to give the best answer.

    However, the index suggested by Luis is guaranteed to require a clustered index lookup to...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    Ed Wagner (12/7/2016)


    DamianC (12/7/2016)


    Revenant (12/7/2016)


    Manic Star (12/7/2016)


    Limbo

    Stick

    Man

    Machine

    War

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need help with querying dates and times

    ZZartin (12/7/2016)


    The logic shouldn't be too complicated add your normal filter in the where clause for the start and end dates which it sounds like you already have then add...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need help with querying dates and times

    Ken McKelvey (12/7/2016)


    The normal approach is to join to a calendar table for the datetime between the given times.

    I'm not sure about this approach. If the datetime column can have...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need help with querying dates and times

    Here's an option that can help.

    IF OBJECT_ID('dbo.DateTimeTable') IS NOT NULL

    DROP TABLE dbo.DateTimeTable;

    CREATE TABLE dbo.DateTimeTable( MyDatetime datetime);

    CREATE CLUSTERED INDEX CI_MyDatetime ON dbo.DateTimeTable(MyDatetime);

    INSERT INTO dbo.DateTimeTable

    SELECT TOP 10000 CAST(...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: trying to get rid of clustered index scan

    Post DDL for tables and indexes involved. Also post the actual execution plan. In a previous post, I shared an article on how to get all that.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: trying to get rid of clustered index scan

    Lynn Pettis (12/6/2016)


    My only other question is why the dynamic SQL for a query that doesn't need it?

    That's probably generated by an ORM.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: trying to get rid of clustered index scan

    Follow the indications on this article for further advice.

    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: trying to get rid of clustered index scan

    If you don't have an index on hcs.AdminObservation(TherapyAdmin_ID) the only option is to use the clustered index.

    The following index might help your query, but will also create overhead on writes....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    Ed Wagner (12/6/2016)


    Ray K (12/6/2016)


    Brandie Tarvin (12/6/2016)


    djj (12/6/2016)


    Ed Wagner (12/6/2016)


    Manic Star (12/6/2016)


    djj (12/6/2016)


    Brandie Tarvin (12/6/2016)


    Kaye Cahs (12/6/2016)


    Grumpy DBA (12/6/2016)


    Ed Wagner (12/6/2016)


    Cream

    Cookies

    Milk

    Santa

    Baby

    Buggy

    Walk

    Amble

    Meander

    Wander

    Lost

    Found

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    crookj (12/5/2016)


    djj (12/5/2016)


    Lane

    Lois

    Lana

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: To create a stored procedure

    swarun999 (12/5/2016)


    create procedure spgetuserdetails

    (

    @UserId nvarchar(255),

    @Password nvarchar(255)

    )

    as

    begin

    declare @count int

    select @count = count(*) from UsersTable where UserId = @UserId and [Password] = @Password

    if(@count = 0)

    begin

    Print...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: convert float to nvarchar not working

    sharon-472085 (12/5/2016)


    hi ,

    first thank you 🙂

    second i do it for test some of tables with float data that i need to convert to

    char. ( dont look for logic...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: To create a stored procedure

    That's pretty basic. What have you tried? What problem are you facing?

    If this isn't homework, I'd be really concerned if you're handling passwords on plain text.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 1,771 through 1,785 (of 8,731 total)