Forum Replies Created

Viewing 15 posts - 2,161 through 2,175 (of 8,731 total)

  • RE: How to use BCP to Import Data from .xls or .csv files

    Use the maxerrors parameter (-m) with a large value to catch the bad rows in an errorfile defined with the parameter -e.

    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 better faster way then REPLACE in this example?

    ghughes (9/21/2016)


    I am wondering if there is a better way............. here was my challenge.

    I have 2 tables and I am attempting to match models. (they are described...

    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 use BCP to Import Data from .xls or .csv files

    You need to add spaces between the parameters, use the correct field delimiter (you stated comma but the sample uses tab), set the first row (to skip the header), set...

    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 use BCP to Import Data from .xls or .csv files

    Please, also share a sample of your input file.

    Here's also the best explanation I've had on importing flat files: http://www.sqlservercentral.com/articles/BCP+(Bulk+Copy+Program)/105867/

    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: Processing Flat file with no delimiters

    Can you start by sharing a sample of the file? It might be possible to do it during the import, but I can't be sure without a sample.

    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: Attempting to change databases using cursor loop, but database won't change

    Eric M Russell (9/20/2016)


    Luis Cazares (9/20/2016)


    Here's an alternative that doesn't rely on undocumented procedures.

    ...

    Yeah, but Microsoft doesn't officially support your method either. :satisfied:

    Doesn't support or doesn't have documentation 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: Attempting to change databases using cursor loop, but database won't change

    Please, disregard my previous post as it does the opposite of what you asked.

    Here's a corrected code:

    DECLARE @DatabaseName NVARCHAR(130)

    DECLARE DatabaseList CURSOR LOCAL FAST_FORWARD FOR

    select QUOTENAME(name)

    from sys.databases

    where name IN...

    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: Attempting to change databases using cursor loop, but database won't change

    Here's an alternative that doesn't rely on undocumented procedures.

    DECLARE @sql nvarchar(MAX) = '';

    SELECT @sql = (SELECT 'DROP TABLE ' + QUOTENAME( DBName) + '..' + QUOTENAME(TableName) + ';' + CHAR(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: T-SQL equivalent of To_number

    It's not syntactically correct.

    SQL Server does not have a boolean data type, it only has a bit data type.

    Your BEGIN has no END.

    You're RETURN does not have anything 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: T-SQL equivalent of To_number

    You have an ISNUMERIC function in T-SQL. That can be misleading, but it works: http://www.sqlservercentral.com/articles/ISNUMERIC()/71512/

    Instead of using To_Number, To_Char & To_Date, T-SQL has CAST and CONVERT. You can also use...

    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: Rounding Tips and Tricks

    braidensjones (9/20/2016)


    Hello,

    I was a bit confused by a section in the article where it's stated that,

    "Note that when dealing with negative numbers, CEILING will continue to go away from...

    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: Coding Alternatives

    Could it be referring to something like a catch-all query?

    http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/

    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: Are the posted questions getting worse?

    Brandie Tarvin (9/20/2016)


    Jeff Moden (9/19/2016)


    More like "people" season. Some people just don't get it. See the following where what someone is doing actually could kill people. I've...

    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: Rounding Tips and Tricks

    John McC (9/20/2016)


    The Conditional rounding is not giving the desired results, based on the statement

    people need to round only if it would round down.

    That would imply an OriginalValue...

    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: I need a list of all the database names that my login has access - SQL help needed

    You just need an additional condition.

    SELECT name

    FROM Sys.databases

    WHERE name not in ( 'tempdb', 'master', 'ReportServer' )

    AND HAS_DBACCESS(name) = 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

Viewing 15 posts - 2,161 through 2,175 (of 8,731 total)