Forum Replies Created

Viewing 15 posts - 6,811 through 6,825 (of 8,731 total)

  • RE: Hours Calculation

    This is something that came to my mind. It won't work if you have two continuous Ins or Outs.

    WITH rowCTE AS(

    SELECT *,

    ROW_NUMBER() OVER(PARTITION BY Name, Reader ORDER BY [TimeStamp])rn...

    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: Question about explicit casting varchar and nvarchar columns

    Maybe you're trying to compare two chapters of a book :hehe:

    I just tried to include all possibilities.

    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: Conversion failed when converting the varchar value '099.0' to data type int.

    Sean Lange (2/26/2014)


    It is hard to figure out exactly what your code is doing but I think the loop would be fairly easy to get rid of too.

    And now it's...

    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: Question about explicit casting varchar and nvarchar columns

    It depends 😀

    If your varchar columns' length could be over 4000, then cast as varchar.

    If not, I would consider casting them as nvarchar (this would be the implicit conversion).

    I would...

    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 to return something when there is no record

    Chris M already gave a solution, but with no DDL and sample data, I'm not giving an example.

    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: Cast as varbinary?

    What's wrong with using CAST?

    SELECT 'CAT', CAST( 'CAT' AS varbinary)

    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 the Package if file aviliable

    You could run your package and use a loop in it to check for the existance of the files.

    You need the following namespace

    Imports System.IO

    Public Sub Main()

    ...

    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: Check Source for Data Prior to Truncation

    What's your source?

    If it's a table, you could do a select (SQL Task), if it's a file you could check for the file size (Script 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: Update a table on multiple rows

    This is very simple, but you need to help us. Please post table definitions, sample data and expected results. For information on how to do it, read the article on...

    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: Foreign Keys are evil?

    frankincognito404 (2/25/2014)


    two developers are in charge of the database schema

    That explains everything 😀

    Foreign keys are tools to mantain and ensure data integrity. Not evil but all the other way...

    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 Tuning - Enhancement ???

    Why do you have LOOP hints in your JOINS?

    A better option is to normalize the data 🙂

    I'm not sure what can you do better. An EAV design won't be great...

    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: elapsed for overlap time

    I'm not sure what you need. I couldn't understand. It would help a lot if you posted table definitions (DDL statements), sample data (Insert statements) and expected output based on...

    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: Dynamic Sql - Must declare the scalar variable

    Sean Lange (2/24/2014)


    patrickmcginnis59 10839 (2/24/2014)


    Sean Lange (2/24/2014)


    patrickmcginnis59 10839 (2/24/2014)


    GilaMonster (2/23/2014)


    Jim Arko (2/23/2014)


    When using dynamic T-SQL you need to concatenate the variables.

    SET @sqlstring = 'UPDATE table SET column = ' +...

    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: Sum values on periods

    I updated my post to include some comments on it. I hope it's easier to understand that way. Try running it one part at a time to understand what it's...

    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: Avoiding Row work in SQL - Part 2

    I can't see the code for that SP, I have no idea on what you could improve.

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