Forum Replies Created

Viewing 15 posts - 4,186 through 4,200 (of 8,731 total)

  • RE: DATEDIFF between date for bills

    reynoso.gonzalez (9/17/2015)


    Good morning,

    I would like to know how I can make a script in SQL Server you can determine the difference days with bills based on date.

    I show you an...

    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: Painful datetime conversion

    Sean Lange (9/17/2015)


    Awesome thanks Luis. I have been focusing on other aspects of this process today and hadn't gotten to writing up a test harness for performance yet. I will...

    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: Painful datetime conversion

    If anyone wonders about performance on the posted solutions.

    CREATE TABLE Testing

    (

    VHRGDT numeric(8, 0) NOT NULL,

    VHRGTM numeric(6, 0) NOT NULL

    )

    INSERT INTO Testing

    SELECT TOP 1000000

    CONVERT( char(8), a.create_date,...

    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: Removing Greek Characters from a String

    Kristen-173977 (9/17/2015)


    Would a binary collation on the REPLACE do the trick?

    The problem wasn't on the collation, even with collation Latin1_General_100_CI_AI (Latin1-General, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive) the alpha and the a...

    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: Painful datetime conversion

    Can I join the party? 😀

    Why are you complaining about a company who follows MS examples? If MS stores dates and times like this it should be right. :hehe:

    Now being...

    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: Removing Greek Characters from a String

    That's because the alpha is a unicode character and you're using ascii characters. In this case, the alpha gets changed into an a.

    Here's a little change in your code:

    DECLARE @letters...

    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: explain query

    That's creating a table with the data returned by the query. The datatypes are defined by the column data types or the expressions used in the query.

    That's not a SQL...

    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: Update a table with date when there are new records in another table.

    Please share DDL and sample data to be able to give a better answer.

    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: Update a table with date when there are new records in another table.

    Use a trigger.

    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: Dynamic String Replacement

    I'm sorry, I missed the simple option (add a WHERE clause to the initial solution).

    SELECT STUFF(

    (SELECT ','+LTRIM(RTRIM(LEFT(Item, CHARINDEX('=', Item + '=') - 1)))

    ...

    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: Dynamic String Replacement

    It gets tricky, but you could analyze your data to find the patterns.

    SELECT Data,

    (SELECT LTRIM( RTRIM(RIGHT( Item, CHARINDEX( ',', REVERSE(Item) + ','))))

    ...

    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: Dynamic String Replacement

    You can find the DelimitedSpli8k function that Scott used (along with its explanation and benchmark) in here: http://www.sqlservercentral.com/articles/Tally+Table/72993/

    And the explanation for the concatenation method using FOR XML PATH in here:...

    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: Smalldatetme (Query with Where, Cast, DATE vs Others)

    Kristen-173977 (9/16/2015)


    Luis Cazares (9/16/2015)


    Here's a small test to prove it.

    Interesting, thanks. I tried it without the CAST and got a query plan that looks like less work - its still...

    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: Multiple queries in the same stored procedure

    You could meet halfway by doing something like this:

    create procedure UberProc (@QueryId varchar(50))

    as

    if @QueryId = 'First Horrible Idea'

    begin

    EXEC OneProcedure @PossibleParameter

    end

    if @queryid = 'Second really bad idea'

    begin

    ...

    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: Smalldatetme (Query with Where, Cast, DATE vs Others)

    Kristen-173977 (9/15/2015)


    where cast(logdate as date) ='20150911' -- 429 Rows

    sadly this is very inefficient because it is not SARGable (well it might be, but a more complex expression/function used on a...

    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 - 4,186 through 4,200 (of 8,731 total)