Forum Replies Created

Viewing 15 posts - 5,536 through 5,550 (of 8,731 total)

  • RE: Read Letters until first Number

    Change the Table Value Constructor to use your table and change the column to your column.

    I'm using the exact name so you can search for the items yourself and 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
  • RE: Read Letters until first Number

    You need a combination of LEFT with PATINDEX.

    SELECT LEFT( String, PATINDEX('%[0-9]%', String) - 1)

    FROM (VALUES('BT67 8kT'),('B68 4HY'))x(String)

    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: Dynamically Convert Date/time from string Error

    You don't need to use an additional table. You just need to use the dynamic sql correctly.

    DECLARE @QUERY NVARCHAR(4000)

    DECLARE @STARTTIME DATETIME

    DECLARE @ProdDBName_testlog VARCHAR(30)

    DECLARE @ProdTableName_testlog VARCHAR(30)

    SET @ProdDBName_testlog = 'master'

    SET @ProdTableName_testlog =...

    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 for update table

    Sean Lange (11/14/2014)


    If you are explicit with your columns you could deal with this in the insert statement. Then the update statement is not needed.

    Something like this.

    insert into OrderB

    (

    City

    ,...

    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: Having issue with implementing CTE in Stored Procedure. Please help!!

    Jason-299789 (11/14/2014)


    Gail/Lynn/Ed,

    I don't disagree, and as Lynn states maybe if MS enforced it so that code wouldn't compile without the use of the statement terminators, like they do in C#/C++...

    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 for update table

    Why do you want to use an IF? That's why we have WHERE clauses.

    UPDATE dbo.OrderB

    SET OrderCity = 'London'

    WHERE OrderCity = ''

    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: Heap or clustered, What to do ...

    g.britton (11/13/2014)


    SeanNerd (11/13/2014)


    My question is about indexing strategy for the following scenario:

    I have a table where we cannot use the typical int identity primary key column. The table can have...

    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 rows into columns

    You could also try cross tabs. Read the following articles on how to work with them and how to make them dynamic.

    Part 1: http://www.sqlservercentral.com/articles/T-SQL/63681/

    Part 2: http://www.sqlservercentral.com/articles/Crosstab/65048/

    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 rows into columns

    Duplicate post.

    All answers in here:

    http://www.sqlservercentral.com/Forums/Topic1634366-392-1.aspx

    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: Error creating temp table based on IF logic

    sqldriver (11/13/2014)


    Luis Cazares (11/13/2014)


    sqldriver (11/13/2014)


    Also, I'm not crazy. I swear.[/url]

    I was expecting something like that. I don't have a similar procedure because I usually don't need it.

    Do you have your...

    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: Error creating temp table based on IF logic

    sqldriver (11/13/2014)


    Also, I'm not crazy. I swear.[/url]

    I was expecting something like that. I don't have a similar procedure because I usually don't need 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: Error creating temp table based on IF logic

    And there's another alternative based on "best practices" 🙂

    DECLARE @PrVers NVARCHAR(128)

    , @PrVersNum DECIMAL(10,2)

    , @command NVARCHAR(4000)

    SET @PrVers = CAST(SERVERPROPERTY('ProductVersion') AS NVARCHAR(128));

    SELECT @PrVersNum = SUBSTRING(@PrVers, 1,CHARINDEX('.', @PrVers) + 1 )

    PRINT @PrVers

    PRINT...

    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: Error creating temp table based on IF logic

    What about creating the table and adding or dropping columns as needed?

    Here's an example dropping the column to preserve the order and prevent confusing the Intellisense.

    DECLARE @PrVers NVARCHAR(128)

    , @PrVersNum DECIMAL(10,2)

    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: Sorting out capitalisation

    Gazareth (11/13/2014)


    Presuming from your other post you're looking for a VB answer:

    =StrConv(Fields!FieldName.Value,vbProperCase)

    Note there's a Reporting Services section further down the page where you'll have more luck with VB, anything 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: Sorting out capitalisation

    We're giving you the code for the user defined functions(UDFs). There's no system function that will complete the problem easily and correctly.

    The code in the functions might be complex 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

Viewing 15 posts - 5,536 through 5,550 (of 8,731 total)