Forum Replies Created

Viewing 15 posts - 7,561 through 7,575 (of 8,731 total)

  • RE: user functions

    Now, there's a small problem. What happens if you ever get a value like 'a23'?

    You should use a numeric datatype, and for even/odd numbers problem, the best type could be...

    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 to pull the data out of a row and into a comma separated string referencing the columnID

    BCP has the queryout option for "selective subsets of tables"

    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: user functions

    If you were asked to write a stored procedure, why would you create a function? :hehe:

    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: Conditional where

    WOW, that's messy. Someone did some bad design decisions.

    Instead of conditional filters, you have to play with logic.

    Instead of

    or if(p.PartNoAlias='',,w.PartNoAlias=p.PartNoAlias))

    You could use

    OR (p.PartNoAlias != '' AND w.PartNoAlias=p.PartNoAlias))

    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: Conditional where

    I would take a different path.

    WHERE (p.PartNoAlias='' OR w.PartNoAlias=p.PartNoAlias)

    However, I'm not sure this is the best for your query. Seems like you're trying to do a left join with...

    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 While Loops (Optimzation)

    Could you explain a little more on what you're trying to do? There are no changes on @Temp1 which I suppose is the dataset you want in the end.

    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: Pivot table with dynamic data

    In my opinion, cross tabs are a lot easier to do dynamic pivoting. for information on this, check the following article: http://www.sqlservercentral.com/articles/Crosstab/65048/

    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: Using a derived table to exludes ID's in it

    This looks weird, You want to exclude ids from your derived table but you're using a column from your derived table. You will only get NULLS for the date.

    To provide...

    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: User scalar function returning null value

    You're not assigning any value to your @DateReturn variable. You just assign the value to @SQLQuery.

    Why are you doing this? You might want to keep away from scalar functions.

    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: Find queries executed in since last 4 hours

    spaghettidba (10/24/2013)


    Luis's suggestion is quite good, but please keep in mind that you won't get the exact sequence of the statements that way.

    For instance, you won't get parameteres for parameterized...

    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: Run jobs in sequence in two different sql servers

    I might be missing information to find the best option, but another idea that comes to me is to add a verifying step on second server at the beginning of...

    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: Run jobs in sequence in two different sql servers

    I would suggest doing a single job using an SSIS package with connections to both servers.

    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: Find queries executed in since last 4 hours

    Something like this?

    SELECT t.text, q.last_execution_time

    FROM sys.dm_exec_query_stats q

    CROSS APPLY sys.dm_exec_sql_text(sql_handle ) t

    WHERE last_execution_time >= DATEADD(HH, -4, GETDATE())

    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: Bulk insert not working

    I suppose that you went through the right path. I'm not sure why were you using a cursor, but a simple insert is a lot better.

    A bulk insert is used...

    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: SSIS Question Help

    What format would the DAT file use?

    Wouldn't a flat file with DAT extension would be enough?

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