Forum Replies Created

Viewing 15 posts - 1 through 15 (of 78 total)

  • RE: Need a SQL Query

    Thanks it works...

  • RE: Need a SQL Query

    Sample Data

    CREATE TABLE ENCOUNTER_PARTY( ENCOUNTER_KEY INT, PARTY_KEY INT, PARTY_ROLE_TYPE_KEY INT)

    INSERT INTO ENCOUNTER_PARTY

    SELECT '3','13855','2' UNION ALL

    SELECT '3','103192','13' UNION ALL

    SELECT '3','110986','3' UNION ALL

    SELECT '4','103192','13' UNION ALL

    SELECT '4','112112','3' UNION ALL

    SELECT '6','13855','2' UNION ALL

    SELECT...

  • RE: Need a SQL Query

    Just one column 101 and 103.

  • RE: Need a SQL Query

    I cant use where clause directly because if will say

    SELECT * FROM ENCOUNTER_PARTY WHERE PARTY_ROLE_TYPE_KEY NOT IN (2)

    It will give me all the rows but except with PARTY_ROLE_TYPE_KEY NOT =...

  • RE: Need a SQL Query

    Expected output is 101 and 103 because those encounters dont have party_role_type_key = 2

    But how to select with query?

  • RE: Need a SQL Query

    Bit change in sample data.

    CREATE TABLE ENCOUNTER_PARTY( ENCOUNTER_KEY INT, PARTY_KEY INT, PARTY_ROLE_TYPE_KEY INT)

    INSERT INTO ENCOUNTER_PARTY

    SELECT 101, 11, 3 UNION ALL

    SELECT 101, 12, 13 UNION ALL

    SELECT 101, 13, 4 UNION ALL

    SELECT...

  • RE: Select SUM MAX Display Person Name

    Try this -

    CREATE TABLE #Temp ( state varchar(10), amt money, per varchar(10) )

    INSERT INTO #Temp

    SELECT 'NSW','130','person1'

    UNION ALL

    SELECT 'QLD','100','person1'

    UNION ALL

    SELECT 'NSW','120','person2'

    UNION ALL

    SELECT 'QLD','200','person2'

    UNION ALL

    SELECT 'NSW','110','person3'

    UNION ALL

    SELECT 'QLD','300','person3'

    SELECT a.State, a.TotAmt, b.Per FROM...

  • RE: Select Count Help

    try this -

    SELECT L.ClientID, S.LocationID, S.ServiceID, COUNT(D.ServiceID) numTrips, SUM(numHours) totalnumHours FROM @Location L INNER JOIN @Service S ON L.LocationID = S.LocationID

    INNER JOIN @ServiceDates D ON S.ServiceID = D.ServiceID

    GROUP BY...

  • RE: Nested Stored Procedure

    We can do it but that will not standard and even it will not achieve great level of correctness.

    as we can find out table names in procedure script with sql...

  • RE: Nested Stored Procedure

    Thanks Atif...

  • RE: Convert Function

    Except if sdate includes a time, in which case dates such as '16/04/2010 12:23:21' will not be returned

    I am not getting please explain...

  • RE: Adding a column

    This is the only option if you dont want to use enterprise manager

    -- creating the new table with the structure required

    CREATE TABLE Emp_temp(

    emp_num INT NOT NULL PRIMARY KEY,

    first_name CHAR(30) NOT...

  • RE: Convert Function

    mister.magoo (4/16/2010)


    yes, you are converting the date to a varchar and then comparing that - which will just be an alphanumeric comparison.

    You need to convert your reference date, which are...

  • RE: Generating delete statement from tablename stored in another table

    gaurav-404321 (4/17/2010)


    This is not working. Stored prcoedure is returning the query as :

    DELETE FROM sectionnumeric

    FROM dbo.CreateSectionTableFromString(placementcandidatelanguageproficiency,placementcandidatetrainingsinternshipsprojects,placementcandidatequalificationdetails)

    This query is giving lot of errors. I think some syntax mistake...

  • RE: selecting column name dynamically

    You can use like this

    Even You can pass the value xxx and yyy as a parameter

    to make it more generalize.

    DECLARE @SQL AS VARCHAR(MAX)

    DECLARE @ColumnToUpdate nvarchar(max)

    DECLARE @ColumnSelected nvarchar(max)

    SELECT @ColumnToUpdate = 'Var1',

    @ColumnSelected...

Viewing 15 posts - 1 through 15 (of 78 total)