Forum Replies Created

Viewing 15 posts - 1,906 through 1,920 (of 8,731 total)

  • RE: Need help with a SQL "least significant digit" algorithm

    BowlOfCereal (11/8/2016)


    drew.allen (11/7/2016)


    Since you want the final result as a numeric value, it doesn't make sense to manipulate the string. Try the following:

    SELECT m.origval, n.comp_val

    FROM #mytab m

    CROSS APPLY (

    SELECT...

    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: Today's Random Word!

    Ed Wagner (11/8/2016)


    Ray K (11/8/2016)


    Manic Star (11/8/2016)


    Ed Wagner (11/8/2016)


    Revenant (11/8/2016)


    Grumpy DBA (11/8/2016)


    Ed Wagner (11/8/2016)


    DamianC (11/8/2016)


    bacon

    Pork

    Belly

    Rub

    Smoke

    Alarm

    Snooze

    Nap

    Sleep

    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: is it possible to determine the max length of a field in a csv file?

    A way to get more accurate results is to use the Advanced tab from the flat file connection.

    There's a button that says "Suggest Types...", there you can tell the number...

    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 data between 3PM and 2AM

    I repeat, change your AND into an OR.

    Or change the time to make them all in the same day.

    selectWeekEnding,

    count(*) as TotalVisits_3To2

    --into #WeekEndingCountTotal_3To2

    from #Test t

    cross apply (

    ...

    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 data between 3PM and 2AM

    NineIron (11/8/2016)


    Where would I get the value for @Date?

    How would I know? You're the one asking for "patients that were registered between 3PM and 2AM the next day."

    I assumed you...

    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 data between 3PM and 2AM

    Something like this?

    DECLARE @Date datetime = '20161002';

    SELECT *

    FROM #Test

    WHERE RegistrationDateTime >= DATEADD( HH, 15, @Date)

    AND RegistrationDateTime < DATEADD( HH, 26, @Date)

    ORDER BY RegistrationDateTime

    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: Is there a way to do a common package based on parameters

    Exactly what Tim said. Just be aware that the tables' structure should be the same on all connections or you'll be prone to 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: Is SSIS import buggy or am I missing anything here on the failing import?

    Did you create the import from scratch, again? It might have kept the length in the package even if the column length was increased.

    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 help with a SQL "least significant digit" algorithm

    You might just need to change "digit / 10" to "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: Need help with a SQL "least significant digit" algorithm

    This might work.

    create table #mytab (origval varchar(max))

    insert #mytab values

    ('1.2'), --should convert to 1.3

    ('6.25'), --should convert 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: Today's Random Word!

    Grumpy DBA (11/7/2016)


    Manic Star (11/7/2016)


    Introvert

    Innie

    Minnie

    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 needed in recursive split

    Here's a different option:

    selecT uc.UserGroup, us.Item

    FROM dbo.DelimitedSplit8K(@UserGroup,'^') gs

    CROSS APPLY (SELECT LEFT( gs.Item, NULLIF(CHARINDEX( '@', gs.Item), 0) - 1) AS UserGroup,

    ...

    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: Create a loop to pass a value from a table

    Maybe something like this could help:

    DECLARE @sql nvarchar(MAX)

    SET @sql = ( SELECT N'EXECUTE sp_order_historay ' + CAST( orderID AS nvarchar(10)) + N';' + NCHAR(10)

    ...

    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: Designing Database in 3NF

    Don't think of tables. You need to start by thinking on entities, attributes and relationships. Create an ER model before even thinking about tables.

    Designing a DB is not a task...

    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: Today's Random Word!

    djj (11/4/2016)


    Ed Wagner (11/4/2016)


    Revenant (11/4/2016)


    Hugo Kornelis (11/4/2016)


    Luis Cazares (11/4/2016)


    Match

    Winner

    Medal

    Olympics

    Olympian

    Zeus

    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 - 1,906 through 1,920 (of 8,731 total)