Forum Replies Created

Viewing 15 posts - 5,701 through 5,715 (of 8,731 total)

  • RE: how do i allow only specific ip address to connect to my sql server

    If you can't do it the right way, you could try an alternative.

    This trigger needs a table to store the allowed IPs. Be sure on what you're doing or 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: Removing Non-Alphabetical Characters

    I just wanted to play around a little bit and this might be a good option to clean the data using an inline table-valued function.

    The function:

    CREATE FUNCTION dbo.CleanNames( @Name varchar(8000))

    RETURNS...

    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: String manipulation functions suddenly consume a lot more CPU

    Would you mind trying with a different version of the function?

    ALTER FUNCTION [dbo].[ProperCase](@String [varchar](4000))

    RETURNS [varchar](4000) WITH EXECUTE AS CALLER

    AS

    BEGIN

    ----------------------------------------------------------------------------------------------------

    DECLARE @Position INT

    ;

    --===== Update the first character no matter what...

    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: String manipulation functions suddenly consume a lot more CPU

    Could you post the function? Have you installed any updates/SP?

    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: Incorrect syntax near the keyword 'pivot'.

    The problem is with your pivot alias. You need to use square brackets if you want to use a reserved word or, even better, change the alias into something less...

    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: Pluggable database equivalent

    Would Contained databases be what you're looking for?

    http://msdn.microsoft.com/en-us/library/ff929071.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: Inserting a dash between some values AND Adding a leading zero if only 5 characters

    MMartin1 (10/8/2014)


    ChrisM makes a good point as a numeric column will not give the expected results...

    Either the column is a char/varchar or will have to be cast at select time...

    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: Discussion About Date Fucntion

    Assuming ExpiryDate is a date/time data type column, I would use the following.

    ExpiryDate >= DATEADD(dd, DATEDIFF( dd, 0, getdate()), 0)

    It's basically the same as

    ExpiryDate >= cast(getdate() as date)

    But 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: Need Help with Stored Procedure

    You're right, I just wanted to point out that there's no guarantee of the order of the results.

    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: Discussion About Date Fucntion

    a4apple (10/8/2014)


    I would use Datediff instead of the cast because I don't want to convert the date again and again. Instead I will just check if the difference of 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: Discussion About Date Fucntion

    DATEDIFF will avoid any usage of indexes on ExpiryDate column.

    DATEPART(dd, date) will return wrong results because you're missing month and year.

    That cast might allow using indexes if the column 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: How do I append underscores based on the Level

    No need for a while loop, you just need to use REPLICATE() function.

    SELECT REPLICATE('_', [LEVEL]) + NAME

    FROM @Tree

    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 Help with Stored Procedure

    ScottPletcher (10/8/2014)


    Hmm, seems to be that code would list the same customer, the "first" one, over and over rather than listing every individual customer in the state. Are 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: CAST or Convert

    That's weird, I'm sure that integers would be implicitly converted into strings as shown on the examples from BOL.

    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: Partition and order the records using sql

    rohit.kumar.barik (10/8/2014)


    Hi John,

    I faced such issue in my work.

    I used two row_number() function

    1st row_number() with partition by docno and date1

    2nd row_number() with partition by docno.

    But i could not order them...

    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,701 through 5,715 (of 8,731 total)