Viewing 15 posts - 616 through 630 (of 897 total)
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...
December 23, 2010 at 9:44 pm
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...
December 22, 2010 at 11:11 pm
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...
December 22, 2010 at 3:44 am
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...
December 17, 2010 at 1:38 am
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...
December 16, 2010 at 11:50 pm
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'...
December 16, 2010 at 3:00 am
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...
December 16, 2010 at 2:05 am
It's quite simple
SELECT*
FROMTableName
WHEREvalue1 <> newvalue1
ORvalue2 <> newvalue2
ORvalue3 <> newvalue3
December 15, 2010 at 9:40 pm
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
December 8, 2010 at 9:58 pm
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
December 8, 2010 at 4:51 am
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...
December 7, 2010 at 10:09 pm
Please provide the DDL and some sample data with the expected results. This will help people to reply faster.
November 30, 2010 at 9:28 pm
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.
November 25, 2010 at 4:46 am
Glad you took my message in the right spirit and I hope my answer clarified your doubt. 🙂
November 25, 2010 at 12:09 am
Viewing 15 posts - 616 through 630 (of 897 total)