Click here to Skip to main content
16,004,727 members
Home / Discussions / Database
   

Database

 
GeneralSqlDataReader : I need to assign retrieved value to C++ variable Pin
Doug13-Oct-02 13:27
Doug13-Oct-02 13:27 
GeneralRe: SqlDataReader : I need to assign retrieved value to C++ variable Pin
Nick Parker14-Oct-02 2:37
protectorNick Parker14-Oct-02 2:37 
GeneralRe: SqlDataReader : I need to assign retrieved value to C++ variable Pin
Doug15-Oct-02 12:15
Doug15-Oct-02 12:15 
GeneralRe: SqlDataReader : I need to assign retrieved value to C++ variable Pin
Nick Parker15-Oct-02 16:38
protectorNick Parker15-Oct-02 16:38 
GeneralRe: SqlDataReader : I need to assign retrieved value to C++ variable Pin
Doug16-Oct-02 12:47
Doug16-Oct-02 12:47 
Generalmsado15.dll Pin
stevenson11-Oct-02 20:11
stevenson11-Oct-02 20:11 
GeneralRe: msado15.dll Pin
Michael P Butler12-Oct-02 1:55
Michael P Butler12-Oct-02 1:55 
GeneralQuestion about Transact SQL Pin
tongc11-Oct-02 6:38
tongc11-Oct-02 6:38 
Hi !

I'm totally new to Transact SQL. I've just been trying to familiarise myself with the below problem and struggling with it for last 6 hours without break.

Here is the schema

HOTEL (Hotel_No, Hotel_Name, Address)
GUEST (Guest_No, Guest_Name, Address)
ROOM (Room_No, Hotel_No, Type, Price)
BOOKING (Hotel_No, Guest_No, Date_From, Date_To, Room_No)

Where it asks what is the total income, for the month of July 2001, from occupied rooms at all the Sheridan Hotels.

How can i implement this in SQL? Or does any one have idea or hints.

Here is my attempmpt at it
<br />
DECLARE @NumberOfDay int<br />
<br />
IF (SELECT Hotel_Name FROM HOTEL WHERE Hotel_Name = 'Sheridan Hotel' and Address = 'Melbourne') = 'Sheridan Hotel'<br />
BEGIN<br />
   PRINT 'Sheridan Melbourne'<br />
   SELECT * FROM HOTEL h1, BOOKING b1, ROOM r1<br />
	WHERE h1.Hotel_Name = 'Sheridan Hotel' <br />
		and Address = 'Melbourne'<br />
		and b1.Date_From < '2001-Jul-01'<br />
		and b1.Date_To  in (Select DatePart(07,01)= true<br />
 <br />
END<br />
ELSE<br />
   PRINT 'Sheridan Sydney'<br />
<br />




I'm trying to program it in SQL in SQL Analyzer, but i have never experienced programming with this transact SQL before. In the first instance, it is like Pascal to me, (IF ..END IF, BEGIN)
GeneralRe: Question about Transact SQL Pin
Richard Deeming11-Oct-02 7:10
mveRichard Deeming11-Oct-02 7:10 
GeneralRe: Question about Transact SQL Pin
tongc11-Oct-02 13:48
tongc11-Oct-02 13:48 
GeneralRe: Question about Transact SQL Pin
Richard Deeming13-Oct-02 22:47
mveRichard Deeming13-Oct-02 22:47 
GeneralSQL Suggestions. Pin
Chris Meech11-Oct-02 4:24
Chris Meech11-Oct-02 4:24 
GeneralRe: SQL Suggestions. Pin
Jon Hulatt11-Oct-02 5:52
Jon Hulatt11-Oct-02 5:52 
GeneralRe: SQL Suggestions. Pin
Richard Deeming11-Oct-02 7:23
mveRichard Deeming11-Oct-02 7:23 
GeneralRe: SQL Suggestions. Pin
Chris Meech15-Oct-02 3:36
Chris Meech15-Oct-02 3:36 
GeneralFast SELECT Count Pin
Luca Leonardo Scorcia11-Oct-02 3:12
professionalLuca Leonardo Scorcia11-Oct-02 3:12 
GeneralRe: Fast SELECT Count Pin
Jon Hulatt11-Oct-02 3:42
Jon Hulatt11-Oct-02 3:42 
GeneralRe: Fast SELECT Count Pin
Daniel Turini11-Oct-02 3:52
Daniel Turini11-Oct-02 3:52 
GeneralRe: Fast SELECT Count Pin
Jon Hulatt11-Oct-02 4:23
Jon Hulatt11-Oct-02 4:23 
GeneralRe: Fast SELECT Count Pin
Luca Leonardo Scorcia11-Oct-02 6:55
professionalLuca Leonardo Scorcia11-Oct-02 6:55 
GeneralRe: Fast SELECT Count Pin
Daniel Turini14-Oct-02 0:55
Daniel Turini14-Oct-02 0:55 
QuestionOnly 255 char? Pin
Rickard Andersson2010-Oct-02 21:30
Rickard Andersson2010-Oct-02 21:30 
AnswerRe: Only 255 char? Pin
Mazdak10-Oct-02 22:01
Mazdak10-Oct-02 22:01 
GeneralRe: Only 255 char? Pin
Rickard Andersson2010-Oct-02 22:40
Rickard Andersson2010-Oct-02 22:40 
GeneralRe: Only 255 char? Pin
Nick Parker11-Oct-02 1:31
protectorNick Parker11-Oct-02 1:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.