Forum Replies Created

Viewing 15 posts - 6,841 through 6,855 (of 8,753 total)

  • RE: How to get Calling DB name within a stored procedure

    er.mayankshukla (10/8/2014)


    Hi All,

    I have a log database where I have all the stored procedure for logging to log tables.

    There are two databases - Dev and Test , which has stored...

  • RE: Why do they not listen?

    Evil Kraig F (10/7/2014)


    ROI is both our enemy and our weapon. Use wisely.

    That is so true, just as beauty, ROI is only in the eye of the beholder

    😎

  • RE: Xquery

    This is even more straight forward to do using the row_number function and set the order to select Current first if it exists, here is a quick sample

    😎

    USE tempdb;

    GO

    SET NOCOUNT...

  • RE: First database design (looking for reviews)

    Further on the subject, first an example of a user, title and status tables with mandatory constraints and keys.

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    GO

    IF OBJECT_ID(N'dbo.TBL_USER') IS NOT NULL DROP TABLE...

  • RE: Are the posted questions getting worse?

    Ed Wagner (10/7/2014)


    Sean Lange (10/7/2014)


    Koen Verbeeck (10/7/2014)


    As if regular spam wasn't annoying enough, one particalar user is now "spamming" the recent posts view with QotD threads...

    That has been going on...

  • RE: Update statement fails - multi-part identifer could not be bound

    Elementary:blush:, add the aliases and a from clause

    😎

    UPDATE ER

    SET ER.LeaveDate = DATEADD(wk,2, FC.enrollDate)

    FROM Fatals_CTE FC

    INNER JOIN DBO.Enroll ER

    ON ER.enrollmentID = FC.t_enrollmentID;

  • RE: Why CROSS APPLY in the below scenario returning records from Left recordset even when there is no matching record in the Right one??

    Quick question, why use cross apply when this can be achieved more efficiently with an inner join?

    😎

    SELECT

    AX.id

    ,AX.name

    ,MAX(BX.sal) AS sal

    FROM...

  • RE: Why CROSS APPLY in the below scenario returning records from Left recordset even when there is no matching record in the Right one??

    Quick thought, the filter is only applied in the scope of the sub-query, effectively a cross apply without a filter which will return all rows. Consider this query instead

    😎

    USE tempdb;

    GO

    SET...

  • RE: update table from variable table column

    You are more or less there, here is a run-able self explanetory example

    😎

    USE tempdb;

    GO

    CREATE TABLE dbo.TBL_TO_UPDATE

    (

    TTU_ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED...

  • RE: sp_trace_setstatus

    Quick suggestion which doesn't use a cursor and also avoids touching the default trace which cannot be altered via the procedure. The @status = 0 turns them off, 1 turns...

  • RE: Long running MERGE

    Luis Cazares (10/6/2014)


    Not sure if I can call it luck. The one in charge of this process decided to remove the MERGE and use a combination of update and insert...

  • RE: Are the posted questions getting worse?

    GilaMonster (10/6/2014)


    Eirikur Eiriksson (10/4/2014)


    Is it just me or does this smell like a spam? A quick search returned few similar postings referencing the same vendor on other sites.

    😎

    It's the same...

  • RE: Drop Temp Tables from INFORMATION_SCHEMA.TABLES

    bpowers (10/6/2014)


    That was it Thanks so much! Any idea how I can run this across three test databases in one piece of code?

    Quick suggestion

    😎

    DECLARE @DB TABLE(DBNAME NVARCHAR(128));

    INSERT INTO @DB(DBNAME)

    VALUES (N'DB_1'),(N'DB_2'),(N'DB3');

    DECLARE...

  • RE: Xquery

    Here is a quick solution, more for prototyping but it works

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    GO

    DECLARE @TXML XML = '<EventOne Date="09/22/2014" ID="12196996" InternalEventOneID="96436969" xmlns:reslib="urn:reslib">

    <EventOneDate>09/22/2014</EventOneDate>

    <TimestampCreate>09/22/2014 11:37:06:413</TimestampCreate>

    <Comment>Comment One!!</Comment>

    <EventZ EventID="834033" EventHistoryID="375381" InternalEventID="4843699" InternalHistoryID="17082526">

    <EventType Word="PLAD">One</EventType>

    </EventZ>

    <EventOne...

  • RE: First database design (looking for reviews)

    Quick first notes (there will be more):

    😎

    "Users"

    1. What attribute or collection of attributes uniquely identifies each user?

    2. Users cannot have middle or additional names?

    3. Full name should be a...

Viewing 15 posts - 6,841 through 6,855 (of 8,753 total)