Forum Replies Created

Viewing 15 posts - 7,696 through 7,710 (of 8,731 total)

  • RE: How to retrieve integer and decimals from string

    No need for a loop. Here's another option that will work with 2 values per line. For more values, you would need to do some changes.

    For the code of dbo.DelimitedSplit8K...

    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: Variable Declaration

    There's not an "official" version. However, the expected version is the current version (2012 at the moment) and 2 previous major versions (2005 and 2008).

    The question might have needed...

    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: Sql Query Output Join with another table

    Put your fisrt query in a subquery or a CTE (Common table expression).

    Then use a (Non-Equi) JOIN using BETWEEN for the ranges and equal for the products.

    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: Inserting into two tables - little help needed

    Am I missing something or would something like this will work correctly and much faster than the cursor?

    CREATE TABLE #OldCustomers(

    OldCustomerID int,

    OldAccountNum varchar(100),

    FullName varchar(100),

    Addressvarchar(100))

    CREATE TABLE #NewCustomers(

    NewCustomerID int,

    AccountID int,

    FullName varchar(100),

    Addressvarchar(100))

    CREATE TABLE #Accounts(

    AccountID...

    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 EDI EAV type table

    Check the following links on using dynamic cross tabs (dynamic pivoting) as they might help you on your problem.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Cross Tabs...

    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: csv to rows

    This post looks really related to this other

    http://www.sqlservercentral.com/Forums/Topic1495877-391-1.aspx

    Is it really about different things? or are you deciphering my code?

    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: Adding time intervals in minutes and display as csv

    patrickmcginnis59 10839 (9/18/2013)


    Nice job on the code Luis!

    Thank you. Now let's hope that kalikoi can understand it or post any questions he/she has. 🙂

    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: String Split

    I might be overcomplicating something but here's another way to do it.

    CREATE TABLE #Input

    (

    String varchar(15)

    )

    INSERT INTO #Input

    SELECT *

    FROM (VALUES('Ørstedsvej 7B'),('Volvo 25D'),('104ND Nokia'))x(x);

    WITH E1(N) 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: Adding time intervals in minutes and display as csv

    Using the correct datatypes might help to simplify the solution.

    CREATE TABLE #THREECOLS

    (

    COL1 TIME,

    COL2 TIME,

    COL3 INT

    )

    INSERT INTO #THREECOLS

    SELECT '11:30','13:30',15

    UNION ALL

    SELECT '00:10','01:40',5;

    WITH E1(N) 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: Reserved Words - 1

    I need some coffee :doze: I calculated the type instead of the hours and got it wrong.

    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: The working of PIVOT

    You're welcome. I'm glad that I could help.

    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: The working of PIVOT

    The query seems complicated but the pivot is really simple. Personally, I prefer CROSS TABS. You can read more about them on this article http://www.sqlservercentral.com/articles/T-SQL/63681/

    and here's an example:

    SELECT IsNull(St.alternateStudyCode,...

    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: Splitting row into 2 rows

    I wouldn't rely on the float conversion. Instead you could CAST as DATE and TIME. Those datatypes can give you just the information you need. Or a direct conversion 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: Pass semicolon deliminated parameter to stored procedure

    Would this article help you?

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

    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: Splitting row into 2 rows

    The easiest way is to do it (at least for me) is with a UNION ALL or a CROSS APPLY "unpivot"

    WITH Sample_Data(EmpNo, DutyId, StartDate, EndDate) AS(

    SELECT 101,

    '01',

    CAST( '2013-08-31...

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