Click here to Skip to main content
15,887,027 members
Home / Discussions / Database
   

Database

 
GeneralRe: @ and @@ parameters Pin
Sonia Gupta18-Oct-07 23:52
Sonia Gupta18-Oct-07 23:52 
AnswerRe: @ and @@ parameters Pin
Pete O'Hanlon21-Oct-07 10:06
mvePete O'Hanlon21-Oct-07 10:06 
AnswerRe: @ and @@ parameters Pin
squattyarun21-Oct-07 23:01
squattyarun21-Oct-07 23:01 
Questioncursors in functions Pin
Sonia Gupta18-Oct-07 22:40
Sonia Gupta18-Oct-07 22:40 
AnswerRe: cursors in functions Pin
Krish - KP18-Oct-07 23:24
Krish - KP18-Oct-07 23:24 
GeneralRe: cursors in functions Pin
Sonia Gupta18-Oct-07 23:35
Sonia Gupta18-Oct-07 23:35 
GeneralRe: cursors in functions Pin
Rocky#19-Oct-07 0:55
Rocky#19-Oct-07 0:55 
AnswerRe: cursors in functions Pin
neeraj_indianic19-Oct-07 19:25
neeraj_indianic19-Oct-07 19:25 
You have not specified that which type of function you want to create means scalar valued function or table valued function.

I suppose that you want to create table valued function. For that your code is wrong in the starting line.
Look at the below code. Hope it will guide you.

CREATE FUNCTION [dbo].[waste]()
RETURNS @student1 TABLE
(
student_rec int,
St_name nchar(10)
)
AS
Begin
declare @a int
declare @b nchar(10)
declare cur cursor for select Id,name from student
open cur
fetch next from cur into @a,@b
while @@FETCH_STATUS =0
BEGIN
INSERT @student1 values(@a,@b)
--SELECT @a as a1 , @b as a2
fetch next from cur into @a , @b
END
close cur
deallocate cur
RETURN
end


Neeraj Gupta
IndiaNIC Infotech Ltd.
QuestionCORBA , MSP Pin
hellogany18-Oct-07 17:36
hellogany18-Oct-07 17:36 
AnswerRe: CORBA , MSP Pin
Colin Angus Mackay18-Oct-07 22:37
Colin Angus Mackay18-Oct-07 22:37 
AnswerRe: CORBA , MSP Pin
Paul Conrad21-Oct-07 10:31
professionalPaul Conrad21-Oct-07 10:31 
QuestionMatching two tables in SQL on certain Fields Pin
Vimalsoft(Pty) Ltd18-Oct-07 4:41
professionalVimalsoft(Pty) Ltd18-Oct-07 4:41 
AnswerRe: Matching two tables in SQL on certain Fields Pin
andyharman18-Oct-07 4:55
professionalandyharman18-Oct-07 4:55 
GeneralRe: Matching two tables in SQL on certain Fields Pin
Vimalsoft(Pty) Ltd18-Oct-07 5:40
professionalVimalsoft(Pty) Ltd18-Oct-07 5:40 
Questionput a default value Pin
Sarfaraj Ahmed18-Oct-07 4:36
Sarfaraj Ahmed18-Oct-07 4:36 
Questionselect statement to another database on another server Pin
Support12318-Oct-07 2:11
Support12318-Oct-07 2:11 
QuestionP.S. Pin
Support12318-Oct-07 2:16
Support12318-Oct-07 2:16 
AnswerRe: P.S. Pin
astanton197819-Oct-07 5:22
astanton197819-Oct-07 5:22 
AnswerRe: select statement to another database on another server Pin
neeraj_indianic22-Oct-07 20:10
neeraj_indianic22-Oct-07 20:10 
Questionhow to capture count of records from stored procedrure Pin
attalurisubbu18-Oct-07 2:01
attalurisubbu18-Oct-07 2:01 
AnswerRe: how to capture count of records from stored procedrure Pin
Illegal Operation18-Oct-07 2:03
Illegal Operation18-Oct-07 2:03 
GeneralRe: how to capture count of records from stored procedrure Pin
attalurisubbu18-Oct-07 2:06
attalurisubbu18-Oct-07 2:06 
AnswerRe: how to capture count of records from stored procedrure Pin
pmarfleet18-Oct-07 2:05
pmarfleet18-Oct-07 2:05 
GeneralRe: how to capture count of records from stored procedrure Pin
attalurisubbu18-Oct-07 2:15
attalurisubbu18-Oct-07 2:15 
GeneralRe: how to capture count of records from stored procedrure Pin
pmarfleet18-Oct-07 2:23
pmarfleet18-Oct-07 2:23 

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.