Forum Replies Created

Viewing 15 posts - 301 through 315 (of 1,494 total)

  • Reply To: value @@trancount in stored procedure

    jejestanko wrote:

    What I want to know is whether, in the same session, several independent stored procedures could be performed at the same time..

    Obviously not. (Except if you are bold enough...

    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
  • Reply To: value @@trancount in stored procedure

    >>Now, let’s imagine that my procedure is not finished but, at the same time, the SQL Server engine executes the procedure stored C on the same session.

    If you are running...

    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
  • Reply To: Get data from daterange

    Maybe:

    SELECT *
    FROM YourTable
    WHERE ExtractDate >= CONVERT(char(6), DATEADD(month, -6, CAST(YEAR(CURRENT_TIMESTAMP) AS char(4))), 112)
    AND ExtractDate < CONVERT(char(6), DATEADD(month, 6, CAST(YEAR(CURRENT_TIMESTAMP) AS char(4))), 112)
  • Reply To: Increment max value by over a complete dataset

    ScottPletcher wrote:

    DECLARE @max_ID int

    SELECT @max_ID = MAX(ID) FROM main_table

    INSERT INTO main_table

    SELECT @max_ID + ROW_NUMBER() OVER(ORDER BY datetime) AS new_ID, ...

    FROM new_data

    That could produce race conditions and deadlocks. The following is...

    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
  • Reply To: Grant user permissions to a view but the base tables live in another database

    As ownership chaining only  works within a database, with a view you will either have to create domain\MyServiceAccount as a user in the Finance database with SELECT permission on the...

  • Reply To: Migration of simple SPs from 120 to 150 COMPATIBILITY_LEVEL issue.

    serverdba wrote:

    SET SHOWPLAN_ALL ON

    This is just the estimated plan.

    SET STATISTICS PROFILE ON gives the actual plan. SET STATISTICS XML ON gives the XML although I just generally right click on...

  • Reply To: Migration of simple SPs from 120 to 150 COMPATIBILITY_LEVEL issue.

    serverdba wrote:

    The execution plan is identical in 120 and 150.

    You say the plans at 120 and 150 are identical but have you verified this by saving both Actual (not...

    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
  • Reply To: Deny View in SSMS but Use View for SSRS

    Row Level Security would usually be based on AD groups or Roles.

    While your problem description is vague I suspect Row Level Security is not the best option here due to...

    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
    • This reply was modified 3 years, 3 months ago by Ken McKelvey.
  • Reply To: Decimal Rounding Differs Between Versions

    Float is an inexact data type so should probably not be used if you want accuracy.

    Microsoft changed the inplementation of float in SQL2016. See Converting float and real data in...

  • Reply To: Union very slow

    DECLARE @sumdocument int;

    WITH Bollore
    AS
    (
    SELECT SEQ_DOC
    FROM OPENQUERY([pprod.link.db.bollore-logistics.com], 'SELECT SEQ_DOC FROM LINK.dbo.DOCUMENT')
    )
    , Bad
    AS
    (
    SELECT SEQ_DOC
    FROM OPENQUERY([pprod.link.db.bad-logistics.com], 'SELECT SEQ_DOC FROM LINK.dbo.DOCUMENT')
    )
    , AllDocs
    AS
    (
    SELECT SEQ_DOC
    FROM Bollore D
    WHERE EXISTS
    (
    SELECT 1
    FROM Link.dbo.EVT_ATT L
    WHERE L.SEQ_DOC =...
  • Reply To: Correct the code

    max(vid) AS vid, nid

  • Reply To: Applying COLLATION Clause to string expressions

    -- Your
    CREATE TABLE dbo.PermTable
    ( Value VARCHAR(100) ) COLLATE DATABASE_DEFAULT

    -- Should be
    CREATE TABLE dbo.PermTable
    ( Value VARCHAR(100) COLLATE DATABASE_DEFAULT );

    -- or just
    CREATE TABLE dbo.PermTable
    ( Value VARCHAR(100));
  • Viewing 15 posts - 301 through 315 (of 1,494 total)