Forum Replies Created

Viewing 15 posts - 616 through 630 (of 897 total)

  • RE: Refresh an open table in SSMS

    loki1049 (12/22/2010)


    Sean Lange (12/22/2010)


    You could just add select * from myTable to your open query window. 😉

    Thanks, but I was just hoping there was something like MS Access uses, its...

  • RE: Strange CASE

    You can use Dynamic SQL for this issue. But since Table Variables defined outside the SQL statement cannot be used in the SQL statement, you will have to use a...

  • RE: Querying a table twice

    If i understood you correctly, you need the Patient Details long with the last attended appointment and the immediate next appointment.

    You can use the ROW_NUMBER() Function for the same

    ; WITH...

  • RE: Problem with date type

    This is called a Subquery in SQL Server.

    http://msdn.microsoft.com/en-us/library/ms189575.aspx

    Here we are selecting the first 5 columns( Patient_Code, Patient_Name, Invoice_Code, Date_Created, Date_Visit ) directly from the table @tblTemp as we normally do.

    For...

  • RE: Problem with date type

    As Wayne has already suggested, NEVER use a code in PRODUCTION if you don't understand it completely. If you use such code without understanding you will find it difficult to...

  • RE: Problem with date type

    This should do it for you

    DECLARE@tblTemp TABLE

    (

    Patient_code int,

    Patient_name varchar(50),

    Invoice_code int,

    Date_Visit date,

    Date_Created date

    )

    INSERT @tblTemp

    SELECT20, 'David', 2, '2010-11-15', '2010-12-15' UNION ALL

    SELECT21, 'Anna', 3, '2010-12-15', '2010-12-15' UNION ALL

    SELECT21, 'Anna', 4, '2010-12-15', '2010-12-15'...

  • RE: random records

    Sachin Nandanwar (12/16/2010)


    Use Top clause without order by clause.

    Select top 10 columnname from yourtable.

    This would mostly give the same result again and again. Use NEWID() in the ORDER BY Clause

    SELECT...

  • RE: where 1 or more is true

    It's quite simple

    SELECT*

    FROMTableName

    WHEREvalue1 <> newvalue1

    ORvalue2 <> newvalue2

    ORvalue3 <> newvalue3

  • RE: T-SQL

    I had run into this problem once after which I avoid 2 digit years. But now I know the reason for the issue. Thanks for the Question and the explanation.

  • RE: SQl Query

    Something like this should help..

    SELECTp_o.prodid, MAX( p_o.posteddate ) posteddate

    FROMprodid p_o

    WHERENOT EXISTS

    (

    SELECT*

    FROMprodid p_i

    WHEREp_i.prodid = p_o.prodid

    ANDp_o.posteddate = DATEADD( DAY, 1, p_i.posteddate )

    )

    GROUP BY p_o.prodid

  • RE: How to copy records in same table as new entry

    Something of this sort

    INSERTINTO TableName( List of coloumns ) -- Columns other than the IDENTITY Column

    SELECTList of coloumns -- Columns other than the IDENTITY Column

    FROMTableName

  • RE: Date Ranges

    I think you would be having another table that has a list of all rooms, I have assumed the same to be @Rooms. If you don't have a table like...

  • RE: Identify if a record exists on a table

    Please provide the DDL and some sample data with the expected results. This will help people to reply faster.

  • RE: retrieve Column Names from Table and Used in QUERY

    You can't use Dynamic queries and temporary tables in a function. So, if you have to implement the Dynamic SQL you will have to use it in a stored procedure.

  • RE: Days in a month

    Glad you took my message in the right spirit and I hope my answer clarified your doubt. 🙂

Viewing 15 posts - 616 through 630 (of 897 total)