Click here to Skip to main content
15,897,704 members
Home / Discussions / Database
   

Database

 
GeneralSELECT INTO Pin
Orville1-Feb-05 8:17
Orville1-Feb-05 8:17 
Generalupdate image column in MySQL Pin
kd83411-Feb-05 4:55
kd83411-Feb-05 4:55 
GeneralRestore SQl DB On Machine Problem... Pin
1-Feb-05 3:51
suss1-Feb-05 3:51 
GeneralRe: Restore SQl DB On Machine Problem... Pin
Rob Graham1-Feb-05 5:48
Rob Graham1-Feb-05 5:48 
GeneralRe: Restore SQl DB On Machine Problem... Pin
Just Greeky Creek2-Feb-05 22:04
Just Greeky Creek2-Feb-05 22:04 
GeneralHangs when attempting to close the Recordset object Pin
CodingFrenzy1-Feb-05 3:06
CodingFrenzy1-Feb-05 3:06 
GeneralRe: Hangs when attempting to close the Recordset object Pin
Rob Graham1-Feb-05 5:56
Rob Graham1-Feb-05 5:56 
GeneralCalling functions in stored procedures Pin
Majid Shahabfar1-Feb-05 2:29
Majid Shahabfar1-Feb-05 2:29 
Hi There,
I've written an inline table-valued function in SQL such as the following:

ALTER FUNCTION dbo.GetCityByID( @CityID int)<br />
RETURNS TABLE<br />
AS<br />
  RETURN(<br />
         SELECT<br />
               Name,<br />
               Url<br />
           FROM Cities<br />
          WHERE (CityID = @CityID) )<br />

suppose that Cities table includes three fields (CityID, Name, Url).

By the way I wrote a store procedure as follow:

ALTER PROCEDURE MyProcedure ( @MyID int)<br />
AS<br />
   SELECT<br />
         CountryID,<br />
         OriginCityID,<br />
         DestCityID<br />
   FROM<br />
         MyTable<br />
   WHERE (MyID = @MyID)<br />

The OriginCityID and DestCityID are related to CityID in Cities table. I wanna get the name
and url of each city by its ID through this stored procedue by making relation to Cities table.
so I call GetCityByID function in my stored procedure like this:

ALTER PROCEDURE MyProcedure ( @MyID int)<br />
AS<br />
   SELECT<br />
         CountryID,<br />
         dbo.GetCityByID(OriginCityID),<br />
         dbo.GetCityByID(DestCityID)<br />
   FROM<br />
         MyTable<br />
   WHERE (MyID = @MyID)<br />

this procedure dosn't work an returns error.

What's your solution for getting information from Cities table for OriginCityID and DestCityID?
Thank you in advance.
GeneralRe: Calling functions in stored procedures Pin
Colin Angus Mackay1-Feb-05 3:28
Colin Angus Mackay1-Feb-05 3:28 
GeneralRe: Calling functions in stored procedures Pin
Majid Shahabfar1-Feb-05 4:34
Majid Shahabfar1-Feb-05 4:34 
GeneralRe: Calling functions in stored procedures Pin
Colin Angus Mackay1-Feb-05 4:43
Colin Angus Mackay1-Feb-05 4:43 
GeneralDate stored as varchar required to be sorted Pin
xcavin31-Jan-05 19:49
xcavin31-Jan-05 19:49 
GeneralRe: Date stored as varchar required to be sorted Pin
Ritesh12341-Feb-05 2:04
Ritesh12341-Feb-05 2:04 
GeneralSQL Replication Conflicts Pin
Daminda31-Jan-05 19:09
Daminda31-Jan-05 19:09 
Generalretrieving datetime from recordset Pin
elephantstar31-Jan-05 8:49
elephantstar31-Jan-05 8:49 
GeneralRe: retrieving datetime from recordset Pin
WoutL31-Jan-05 10:59
WoutL31-Jan-05 10:59 
GeneralRe: retrieving datetime from recordset Pin
elephantstar31-Jan-05 11:14
elephantstar31-Jan-05 11:14 
GeneralTrigger Dates Pin
Tom Wright31-Jan-05 7:41
Tom Wright31-Jan-05 7:41 
GeneralRe: Trigger Dates Pin
Colin Angus Mackay31-Jan-05 9:38
Colin Angus Mackay31-Jan-05 9:38 
GeneralRe: Trigger Dates Pin
cmk31-Jan-05 9:53
cmk31-Jan-05 9:53 
GeneralRe: Trigger Dates Pin
Tom Wright31-Jan-05 11:53
Tom Wright31-Jan-05 11:53 
GeneralRe: Trigger Dates Pin
cmk31-Jan-05 14:23
cmk31-Jan-05 14:23 
GeneralRe: Trigger Dates Pin
Tom Wright1-Feb-05 11:11
Tom Wright1-Feb-05 11:11 
GeneralRe: Trigger Dates Pin
cmk1-Feb-05 16:47
cmk1-Feb-05 16:47 
GeneralRe: Trigger Dates Pin
Tom Wright2-Feb-05 4:39
Tom Wright2-Feb-05 4:39 

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.