Forum Replies Created

Viewing 15 posts - 5,386 through 5,400 (of 8,731 total)

  • RE: Lists

    g.britton (12/23/2014)


    The problem with the fourth option is that the nested query needs to be in parentheses. So this works:

    SELECT SUBSTRING( ( SELECT ', ' + productname...

    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'm arguing with BCP

    That shouldn't be a problem, but I'm not sure if your format file is correct.

    Here's one example that I use, it might help you out.

    <?xml version="1.0"?>

    <BCPFORMAT

    xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <RECORD>

    ...

    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: TRIM and/or REPLACE in editing a lot of text fields

    Instead of fighting with this, why don't you do things correctly? You should store each value in its own 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: SQL Bug!

    I'm sure the bug is logged under code PEBKAC. There's an easy fix for that but it might not correct it the first time you apply 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: T-SQL

    tjskidmore (12/19/2014)


    This is of course a limitation with the ISNULL() function. The datatype and in this case str1 is varchar(5) meaning that the replacing statement will be confined to 5...

    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 the string in a field contain a capital 'H' or 'D' in the left 3 characters - Scalar Function returns T/F

    Yes, it's intended to look simpler as the conditions are reduced by half. Note that I changed the collation, basically because I have a case insensitive collation and because binary...

    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: CONVERT nvarchar to numeric

    ichv (12/17/2014)


    Hi,

    I have exactly the same issue, and the found that solution perfect but it still getting error.

    My question is: how could I find the row producing error? I...

    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 the string in a field contain a capital 'H' or 'D' in the left 3 characters - Scalar Function returns T/F

    Noobie in deed 😛

    DECLARE @CountResult int, @ID_Wells int = 1

    Set @CountResult =(SELECT COUNT(*)

    FROM (VALUES(1, 'SomethingH'),

    (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: Conversion failure varchar to int

    Two side notes:

    1. A table with one row will return the message that has more than 1 row. :w00t:

    2. If you don't care about the number of rows in the...

    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 failure varchar to int

    Your variable is declared as integer and you're assigning a string value. Read about sp_executesql to understand how to use parametrized dynamic queries. Using parametrized queries, you can use an...

    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: declare variable with last month's date [yy-mm-01] and [yymm]

    The problem is that you aren't assigning length to your strings. There's no need to use varchar since you're always going to have the same length. Here's an example:

    DECLARE @RPT_DTA...

    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: Trying to figure out how to implement nested tables

    It's good to know that you found a solution to your problem.

    Remember that there's not a "one-code-to-rule-them-all" and you need to test possible approaches to find out which one is...

    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 have no id

    Lance,

    You continue to mention that this is a bug while it's actually a feature that allows us to write correlated subqueries. It's a feature that can cause bugs, but...

    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: Trying to figure out how to implement nested tables

    It seems that you edited your reply. I wonder if it was due to security/privacy concerns.

    I'm not sure what the issue was as it seems that it should work 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: Help with splitting data between two columns

    I hope that this is some kind of weird reporting requirement as it shouldn't be used to store data unrelated in the same row of a table.

    WITH SampleData(Main) 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

Viewing 15 posts - 5,386 through 5,400 (of 8,731 total)