Forum Replies Created

Viewing 15 posts - 7,141 through 7,155 (of 8,731 total)

  • RE: Replace order of operations

    A scalar defined function as you posted, will giev you performance problems. Try to use an iTVF as explained on this article to make it perform much better.

    http://www.sqlservercentral.com/articles/T-SQL/91724/

    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: How to check wheter a value is whole number or in fraction

    A couple of additional methods 🙂

    IF (FLOOR(@number) = @number)

    PRINT 'whole number';

    ELSE

    PRINT 'has fractional component';

    IF (CEILING(@number) = @number)

    PRINT 'whole number';

    ELSE

    PRINT 'has fractional component';

    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: Replacing recurring characters in a string with single character

    To use the solutions provided with a table column instead of a variable. You just need to change the variable declaration to a function definition and call it with cross...

    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: Mastering Dimensions of Time

    Here's an extract of the procedure to populate date dimension (I removed columns needed in my company and left some that might be relevant). We populate it by year, sowe...

    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: Variables

    blasto_max (1/20/2014)


    Try this example - Select any data from SQL server into a result set (hint SSIS Object) and use a script task to write it to a file.

    To write...

    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: Variables

    Here's an article that might help you. It's part of a Stairway Series and I recommend you to read the complete series 😉

    http://www.sqlservercentral.com/articles/Integration+Services+(SSIS)/99720/

    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: How to check errorlog from CMD.

    I haven't gone deeply into it, but an article from today's homepage might help. https://www.simple-talk.com/sql/database-administration/the-posh-dba---reading-and-filtering-errors/

    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: 3 Table Query Question

    That's exactly what I had in mind. It's always better when people are able to find an answer on their own.

    By the way, you should think on changing the design...

    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: 3 Table Query Question

    This is easily accomplished with joins and an aggregate function. I have no intention on doing your homework, but I can guide you on specific questions that you have.

    In short,...

    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: How to find particular table is present in which database

    This script might help you.

    DECLARE @bd varchar(128),

    @Table_Namevarchar(128) = 'TABLE_NAME_SEARCHED'

    CREATE TABLE #Tables(

    bdvarchar(128),

    table_namevarchar(128))

    DECLARE bases CURSOR LOCAL FORWARD_ONLY STATIC READ_ONLY FOR

    SELECT name

    FROM sys.databases

    WHERE database_id > 4

    AND state = 0

    OPEN bases

    FETCH NEXT FROM bases...

    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: get sum multiplied values from function

    Shanmuga Raj (1/20/2014)


    I need to use recursive funtion since i have the stored proedure with more data columns.

    No, you don't. You need to understand how the query works to use...

    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: Outer Apply/Cross apply or a join I haven't thought of?

    richardmgreen1 (1/20/2014)


    So the cte is almost acting as a temporary table having an insert done on it?

    That makes sense.

    It's more like a single use view. Remember that even if it...

    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: get sum multiplied values from function

    As Sean said, a recursive function will give a horrible performance.

    For cases like this one, I like to use recursive CTEs, but you might to be aware that performace 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: Replacing recurring characters in a string with single character

    Here's a different method that might work well. Should we start testing? 😀

    DECLARE @code nvarchar(4000) = '12333345566689';

    with seed1 (a)

    as

    (

    select 1 union all select 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: Outer Apply/Cross apply or a join I haven't thought of?

    I'll try to explain. You could think of a CTE as if it were a subquery. You can select the query in the cte to view what is the result...

    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 - 7,141 through 7,155 (of 8,731 total)