Forum Replies Created

Viewing 15 posts - 6,556 through 6,570 (of 8,731 total)

  • RE: Nvarchar to Float

    gbritton1 (4/24/2014)


    Here's a great article on the topic:

    http://www.brentozar.com/archive/2012/07/identifying-correcting-sql-server-implicit-conversion/

    I stopped relying on implicit conversion years ago. In fact, in all languages I write I try to adhere to the "Explicit...

    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: Generate unique values

    Sean Lange (4/24/2014)


    Why not just increase the length to 36 characters and use newid()?

    Or you could use an identity column and use ASCIIEncoding to convert the value to a...

    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: Nvarchar to Float

    gbritton1 (4/24/2014)


    Luis Cazares (4/24/2014)


    You don't need explicit conversion. The insert will handle it implicitly.

    Sure, but Explicit is better than Implicit. SQL Server sometimes does not give you the implicit...

    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: Generate unique values

    Stop working to get something you could easily get by using Identity or SEQUENCE as stated by twin.devil.

    You should use a PK (or unique) constraint as well to ensure uniqueness....

    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: Weekly Best Seller

    David Burrows (4/23/2014)


    ;WITH cte (ProductId,Pos) AS (

    SELECT ProductId,

    RANK() OVER(PARTITION BY SaleYear,SaleWeek ORDER BY Quantity DESC)

    FROM SalesData)

    SELECT ProductId,SUM(1-SIGN(Pos-1))

    FROM cte

    GROUP BY ProductId

    This is clever: SUM(1-SIGN(Pos-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 Query Help

    This might be simpler.

    WITH Clm2Values AS(

    SELECT Clm1,

    CASE Clm1 WHEN 'Trauma' THEN 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: Nvarchar to Float

    You don't need explicit conversion. The insert will handle it implicitly.

    CREATE TABLE #Testchar(

    myvarchar nvarchar(10)

    )

    CREATE TABLE #Testfloat(

    myfloat float

    )

    INSERT #Testchar VALUES('3.14159E0')

    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: Normalize values from column split using tally table

    Have you read about the Delimited8kSplitter?

    Check it on this article: http://www.sqlservercentral.com/articles/Tally+Table/72993/

    It will show you how it works and how to use 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: Joining where values do not equal one another

    I would create an additional table to include the item's codes conversion. That way you can add it to your joins to keep an equality.

    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 Syntax error

    Post the exact error you're getting.

    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 Help requested to Get Daily and Weekly OT

    Can you explain why is this not correct?

    SET DATEFIRST 1;

    WITH SampleData (PERSON, [DATE], [HOURS], [DOW]) AS

    (

    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: how can i restrict the query on query window that contain *(astric)

    I can understand the need to prevent the use in production code, but not in ad-hoc queries when developing and testing (I often use it to evaluate a table structure).

    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: Bulk Insert Issue

    MMartin1 (4/22/2014)


    Extra comma's where? Do you mean there were extra fields in the text file that had empty string values? Else the purpose of the double quotes is to denote...

    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 and Replace Injection String in Server 2005

    allaspects (4/9/2014)


    Lynn is obviously trolling. Sad that on a resource such as this website, someone is out to troll and not help.

    That's why the world can't have nice things.

    That's a...

    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: Does anyone care that I passed 70-461?

    Maybe you could do some networking if there's a local PASS chapter near you.

    http://www.sqlpass.org/PASSChapters/LocalChapters.aspx

    That way you'll be able to speak with SQL Server professionals and prove that you might 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

Viewing 15 posts - 6,556 through 6,570 (of 8,731 total)