Forum Replies Created

Viewing 15 posts - 6,421 through 6,435 (of 8,731 total)

  • RE: Are cursors hard on servers?

    MMartin1 (5/23/2014)


    I would take a cursor over a triangular join if I was reporting on a running total in a columns. That's once instance.

    That's ok if you can't (or don't...

    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 find the difference between two sub-totals (sales - credits)

    Another option:

    SELECT ItemCode, SUM([Total Sales]) as 'Total Sales'

    FROM(

    SELECT T0.ItemCode, SUM(T0.LineTotal) as 'Total Sales'

    FROM INV1 T0

    WHERE...

    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: Datetime conversion

    As Sean said, datetime data types don't have format. If you define your column type in your flat file connection, and insert the value in a datetime column, you won't...

    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: Calculating working hours between 2 dates.

    Nice Nevyn 😉

    To be honest, I'd prefer your option over mine, but I wanted to avoid dependance on the schema in case that someone can't create new tables.

    Yours is simple...

    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: Insert a breaking character into a string at regular intervals

    Would something like this help?

    I included some commented code to help you to test.

    DECLARE @str varchar(100), @str1 varchar(120) = ''

    SET @str = '11111111112222222222333333333344444444445555555555666666666';

    WITH E1(n) AS(

    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: Calculating working hours between 2 dates.

    I might have overcomplicated this, but it might be worth it. Unless someone else comes with a better version of this. If you want to go further, you can generate...

    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: weird arithmetic overflow error

    The problem is that OBJECT_NAME expects an int value and l.resource_associated_entity_id is a bigint.

    Maybe changing the last condition would solve the proble, but I'm not sure if it will give...

    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: Building a self-referencing hierarchical table.

    These articles might help you:

    Hierarchies on Steroids #1[/url]

    Hierarchies on Steroids #2[/url]

    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: What is the fastest way to manage date filtering within a query?

    What's the type of your begindate column?

    For performance advice, read the following article: 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: Export column from SQL to .txt format

    There might not be any need to go to SSIS.

    If you have some kind of primary key, you could use it to generate all the files with a cursor.

    DECLARE @id...

    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: Return parent record of child record

    If you have more than one level, you could use a recursive CTE.

    create table #Parent

    (

    PKint primary key not null,

    Descrvarchar(10) not null,

    Reference_PKint ...

    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: help with store procedure

    There's still nothing I can do to help because I don't understand what do you need. You said something about an update, but there's nothing there that could be modified...

    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: help with store procedure

    There's not much we can do for you. You didn't share the stored procedure, you just copied a select statement. We don't know your environment and the requirement is unclear.

    If...

    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: Replace variable emails in long sting with blank@blank.com

    I'm not sure what would you consider simple.

    If you're able to store your xml in a table without the xml, you could easily update the table. The problem with this...

    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: Difference in seconds to round to minute

    Thank you for the feedback. If I'm not mistaken, you could select both. 😀

    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 - 6,421 through 6,435 (of 8,731 total)