Forum Replies Created

Viewing 15 posts - 3,916 through 3,930 (of 8,731 total)

  • RE: Query Performance tuning for cursor

    Junglee_George (11/4/2015)


    Hey, This is how I tuned my query to avoid cursor in my code. Hope it helps. ...

    If any suggestions are there, all are welcome.

    My suggestion is for 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: Not able to pass the variable into the Query...Trying to pass the user information into the code to remove the dependencies and drop the users

    I'm not at my computer right now, but you should check sp_executesql to use parameters with dynamic sql

    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: Not able to pass the variable into the Query...Trying to pass the user information into the code to remove the dependencies and drop the users

    vamsi.341 (11/3/2015)


    Hi Luis,

    If you see the storedprocedure parameters, i am passing the USER as a parameter to the storedprocedure..

    I tried using cursor instead of SP_MSForeachDB, same issue it's not accepting...

    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: Not able to pass the variable into the Query...Trying to pass the user information into the code to remove the dependencies and drop the users

    Of course it's not accepting the variable as you don't send it as a parameter, nor you declare it inside your dynamic code.

    My suggestion is to avoid the undocumented procedure...

    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: Not able to pass the variable into the Query...Trying to pass the user information into the code to remove the dependencies and drop the users

    Why are you doing additional work?

    set nocount on

    DECLARE

    @AlterAuthorizationStatement nvarchar(MAX) = N''

    , @db_user nvarchar(10)

    set @db_user='test'

    SELECT @AlterAuthorizationStatement = @AlterAuthorizationStatement + N'ALTER AUTHORIZATION ON SCHEMA::'...

    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 Nexux

    I've never used SQL Nexus before, so I can't help, but I just wanted to suggest to post your issue on the discussions for that tool. https://sqlnexus.codeplex.com/discussions

    I hope that 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: SQL Injection - What to look for in a string

    You should also use QUOTENAME( @fieldName) which would fix any problems causing SQL Injection. Or you could also validate its value against system views.

    -- Your Parameters

    DECLARE @fieldName varchar(128),

    ...

    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?

    Eirikur Eiriksson (11/2/2015)


    Lynn Pettis (11/2/2015)


    SQLRNNR (10/31/2015)


    For thread posterity:

    It was awesome to get to meet some of the denizens of The Thread last week. Too bad Jeff Moden wasn't able...

    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: Msg 156, Level 15, State 1, Line 2, Incorrect syntax near the keyword 'AS'.

    SQL Server doesn't use the syntax CREATE TABLE...AS... Instead, it uses SELECT...INTO...

    This should be what you're looking for.

    SELECT mecase.CASETYPE AS [Case#],

    mecase.mannerappears AS [Appearstobe],

    ...

    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: Risks of NOLOCK, part 1

    TomThomson (11/2/2015)


    I got this one wrong because I reckoned that when there is no concurrent activity the saving from not requesting shared locks is so small as to be absolutely...

    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 to grant permission but avoid SQL injection

    Probably something like this:

    DECLARE @cmd varchar(8000),

    @protectType varchar( 6),

    @action varchar(8000),

    @object varchar(128) = 'sysdbfrag',

    @grantee varchar(128);

    IF @protectType...

    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: Split time span into multiple records

    It makes sense to generate reports that show data per date. It won't make sense to generate additional data that will be simply duplicating rows.

    Here's an example I did playing...

    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: Split time span into multiple records

    It's possible by using a calendar table, but it doesn't make sense to duplicate rows when you're not adding anything special. Why do you want to have 3 ranges instead...

    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 format data in a grid view (pivot?)

    I'm not sure what you mean. What would be the problem?

    INSERT INTO #TempTable(StringColumn) VALUES( @StringVariable);

    --OR

    INSERT INTO #TempTable(StringColumn) SELECT @StringVariable;

    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: NULL and empty string question...

    Jason A. Long (10/30/2015)


    Luis Cazares (10/30/2015)


    Ian Scarlett (10/30/2015)


    I believe that most theorists would prefer blank spaces instead of null values.

    Really? I understand the grief nulls can cause, 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 - 3,916 through 3,930 (of 8,731 total)