Forum Replies Created

Viewing 15 posts - 1,291 through 1,305 (of 2,007 total)

  • RE: How to get records in groups

    SameerKKhan (11/24/2011)


    I have three Tables.One is

    EmployeeMaster(EmpCode,EmpName,MobileNo)

    Sample Date EmployeeMaster(1,SameerKhan,4512541321)

    ClassMaster(ClassId,ClassName,EmpCode)

    Sample Data ClassMaster(1,ClassA,1)

    Here EmployeeCode in ClassMaster is the EmpCode from EmployeeMaster.

    Attendance(StudentID,Class,Status)

    sample data Attendance(445,ClassA,Absent)

    Here Class will come from ClassMaster

    Now suppose...

  • RE: Re-work of MAX query adds unwanted rows

    James123 (11/24/2011)


    It doesn't matter which row is returned. If a case has two documents created on it in one day, I just need to know that a document was created...

  • RE: Re-work of MAX query adds unwanted rows

    James123 (11/24/2011)


    Sorry, I should have said that I'm working in SQL 2000 so I can't use OVER()

    You're right, I could check the ROW_NUMBER() but I only actually need to know...

  • RE: Re-work of MAX query adds unwanted rows

    James123 (11/24/2011)


    Thanks for that. That's narrowed the returned dataset but we still have duplicates where rows with the same CREATIONDATE exist

    CREATIONDATE | ...

  • RE: Re-work of MAX query adds unwanted rows

    James123 (11/24/2011)


    Hello,

    I have a document history table which records all of the documents created on all cases. I currently return the date of the most-recently created document and a case...

  • RE: Query optimizing tips needed

    Hello and welcome to SSC!

    The main reason that you are not getting any replies for your question, it that we don't have enough information from you to answer!

    For starters, it...

  • RE: CONVERT INT YYYYMM TO DATEtime

    eseosaoregie (11/24/2011)


    oh ok thanks. and the dateadd function. what is it doing?

    Sorry, didn't see that part of your question.

    @MyToMonth/100 <-- as both of these are INT, this essentially removes the...

  • RE: CONVERT INT YYYYMM TO DATEtime

    eseosaoregie (11/24/2011)


    I have recently found some sql script on the net that converts an integer of format yyyymm to a date time. I have used it and it works. HOwever...

  • RE: Distinct-tify TWO columns into ONE column

    Look up UNION.

    --First, let's setup your sample data

    DECLARE @TABLE AS TABLE (Date1 DATETIME, Date2 DATETIME)

    INSERT INTO @TABLE

    SELECT '2011-11-01 00:00:00.000', '2011-11-01 00:00:00.000'

    UNION ALL SELECT '2011-11-01 00:00:00.000', '2011-11-02 00:00:00.000'

    UNION ALL SELECT '2011-11-02...

  • RE: T-SQL QUERY TO RETURN SOME DATA

    Plenty of ways to do this.

    DECLARE @table1 AS TABLE (nm CHAR(2), INT, address CHAR(3), abc CHAR(2), efg INT, xxx CHAR(1))

    INSERT INTO @table1

    SELECT 'aa', 1, 'bks', 'hj', 2, 'e'

    UNION ALL...

  • RE: Looping through Databases to fix orphaned users

    SQLSeTTeR (11/23/2011)


    Thank you everyone! When I run the query, I am getting the following:

    Msg 214, Level 16, State 2, Procedure sp_executesql, Line 1

    Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.

    Sorry,...

  • RE: Looping through Databases to fix orphaned users

    SQLSeTTeR (11/23/2011)


    Is it possible to loop through all DB's with the following script?

    DECLARE @user SYSNAME

    DECLARE @sql NVARCHAR(300)

    DECLARE cur_Users CURSOR FOR

    SELECT name

    FROM sysusers

    WHERE islogin =...

  • RE: Select all from 1 file and top from another

    stephen.staple (11/23/2011)


    Thank you GSquared. I actually ended up with a very similar solution to yours.

    First I defined a function:

    create FUNCTION [dbo].[fn_GetTopMatch1](@LoginID AS int)

    RETURNS TABLE

    AS

    RETURN

    --

    SELECT ...

  • RE: Split string into multiple columns

    Jeff Moden wrote an article about splitting delimited stings here[/url].

  • RE: Select all from 1 file and top from another

    stephen.staple (11/22/2011)


    Come on you useless bunch of bum bandits. Answer the freaking question.

    The main reason that you were not getting any replies for your question, it that we don't have...

Viewing 15 posts - 1,291 through 1,305 (of 2,007 total)