Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help with SP

Author  Topic 

android.sm
Starting Member

36 Posts

Posted - 2010-05-11 : 19:09:51
my database has two tables. Category(CategoryId, Category), Quote(Id, CategoryId, Quote) these two tables are related via FK (CategoryId).

i need help with my sp. it should return me a quote when i pass an ID to it.

SP code:

CREATE PROCEDURE GetQuote (@CategoryId VARCHAR(2)

AS

SELECT Quotes.Quote

FROM Quotes, Category

WHERE Quotes.CategoryId = @CategoryId

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2010-05-11 : 19:18:20
[code]CREATE PROCEDURE GetQuote (@CategoryId VARCHAR(2))
AS
SELECT DISTINCT Quotes.Quote
FROM Quotes
WHERE Quotes.CategoryId = @CategoryId[/code]
Go to Top of Page

android.sm
Starting Member

36 Posts

Posted - 2010-05-14 : 20:06:29
hey thanks for that. it now works :)
Go to Top of Page

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2010-05-14 : 22:38:00
quote:
Originally posted by android.sm

hey thanks for that. it now works :)


Good

______________________
Mayazar Mori Ke Dane Keshast
Go to Top of Page
   

- Advertisement -