Forum Replies Created

Viewing 15 posts - 226 through 240 (of 463 total)

  • RE: Using a variable to populate select statement

    Is this what you want?

    CREATE TABLE #t(AREA varchar(10))

    INSERT INTO #t VALUES('AREA1')

    INSERT INTO #t VALUES('AREA2')

    INSERT INTO #t VALUES('AREA3')

    DECLARE @VAR1 as varchar(10)

    SELECT TOP 1 @VAR1 = AREA FROM #t

    PRINT @var1

    ---------------------------------------------------------------------------------

  • RE: Add row to the SQL result?

    you have an advantae with this that, if any duplicates are there, its removed.

    Create table #t(ID int, Name varchar(10))

    INSERT INTO #t VALUES (1, 'abc')

    INSERT INTO #t VALUES (2, 'def')

    INSERT INTO...

    ---------------------------------------------------------------------------------

  • RE: Select Top Records grouped by Field,

    eddy-644184 (11/4/2009)


    Hi Nabha,

    Tnx a lot,

    Thats idd what i wanted to get as result.

    I really need to learn the Partition By statement, it is so powerfull when you need stuff...

    ---------------------------------------------------------------------------------

  • RE: Select Top Records grouped by Field,

    I changed the name from your table name to #t, see if this is what you want!

    SELECT * FROM

    (Select *, Row_number() OVER (partition by SRV_ID, DSP_DiskNaam

    ORDER BY DSP_Datum...

    ---------------------------------------------------------------------------------

  • RE: Max Record

    You have to be clear with your test data and expected result. It was very vague information that you are giving! Anyway, if you need the latest status based...

    ---------------------------------------------------------------------------------

  • RE: Dynamic Sql Query problem

    you should handle the case when there is no dept for an employee.

    Just to make this work, in your d-sql replace @dept with

    ISNULL(@dept, '')

    your print would work!

    ---------------------------------------------------------------------------------

  • RE: Max Record

    remove status column from your group by!

    ---------------------------------------------------------------------------------

  • RE: Converting 01.12.2005 into 1-Dec 2009 while insert

    Select convert(varchar(11),(convert(datetime, '01.12.2005', 104)), 113)

    ---------------------------------------------------------------------------------

  • RE: Query to show dates in columns

    See if this helps, i am using max function now. You might need to use some concatenation function to get all the three values. Thats next step. I cant think...

    ---------------------------------------------------------------------------------

  • RE: Converting 01.12.2005 into 1-Dec 2009 while insert

    pramod_yg (11/4/2009)


    it is interpreting it as 12 Jan 2009. i want it to be 12 Jan 2009.

    Pramod

    both are same right?

    ---------------------------------------------------------------------------------

  • RE: Using a table alias

    aravind.s (11/3/2009)


    if there is a column with the same name in 2 tables and if those tables are participating in a join then adding aliases to the tables and subsequently...

    ---------------------------------------------------------------------------------

  • RE: Query to show dates in columns

    I see what you are trying to do. Along with pivot u got to expand the number of days between start date and enddate and get your values for that....

    ---------------------------------------------------------------------------------

  • RE: Creation of New Instance in SQL Server 2005

    BOL,

    On the Instance Name page, select a default or named instance for

    your installation. If a default or named instance is already installed, and

    you select the existing instance...

    ---------------------------------------------------------------------------------

  • RE: Access SQL Server via .NET acpplication and not by SSMS

    Have you had a chance to look at the post by lowell? I thought it solves your problem!

    ---------------------------------------------------------------------------------

  • RE: Missing Local Server after MSSQL 2005 Installed

    Run command - > services.msc -> look for SQL Server. If you have 'MSSQLSERVER' within the parenthesis after sql server then its your default instance. something like this, SQL Server...

    ---------------------------------------------------------------------------------

Viewing 15 posts - 226 through 240 (of 463 total)