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
 Express Edition and Compact Edition (2005)
 Stored Procedure in SQL express ( need help)

Author  Topic 

crash893
Starting Member

5 Posts

Posted - 2006-04-05 : 17:54:40
Hi all,

I am trying to write a stored procedure and i just can't get it to work

can you find anything wrong with this that would make it not enter the data into a row?

[code]

ALTER PROCEDURE dbo.Insertprimerank
(
@Rank numeric (18,0),
@dat_time datetime,
@years numeric(18,3) ,
@cleared numeric(18,0)

)
AS
/* SET NOCOUNT ON */
INSERT INTO rank_table
(rank, dat_time, years, cleared)
VALUES (@Rank,@dat_time,@years,@cleared)
RETURN
[\code]

The table is named rank_table
dat_time is the primary key

I would really appreshate any help i have been trying to figure this out for about 2 weeks now

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-04-05 : 17:56:46
What is the error that you are getting? If no error, does it insert the row if you execute the stored procedure from Query Analyzer?

Tara Kizer
aka tduggan
Go to Top of Page

crash893
Starting Member

5 Posts

Posted - 2006-04-05 : 22:31:10
It doesnt throw an error but it also does not add any new values to the table when i run it independently


I created this SP from an example from a driffrent program
i was unclear why he has what looks like definetions in the begining

"@rank numeric(18,0),"

I changed there values to match the feilds in my database but im still unclear on what they do

thanks so much for helping
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-05 : 23:03:28
" It doesnt throw an error but it also does not add any new values to the table when i run it independently"
Is there any trigger on the table that somehow block the insert ?



KH


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-04-06 : 11:55:47
Where are you executing the stored procedure from? From Query Analyzer or your application?

Tara Kizer
aka tduggan
Go to Top of Page

crash893
Starting Member

5 Posts

Posted - 2006-04-06 : 15:05:07
Im not sure i understand i am still kinda of a noob at this

i have a line in my code ( vb.net) that sends the valuses in order to the stored procdedure
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-04-06 : 15:09:02
So you are executing it in your application. You need to take a step back and ensure that the stored procedure even works, so that means you need to try it out in Query Analyzer. Like this:

EXEC dbo.Insertprimerank 1.0, GETDATE(), 1.0, 1.0

Substitute values instead of what I have. Check the table, did the row get inserted? If so, then the problem is in your VB.NET code and not with the stored procedure.

If you are unfamiliar with Query Analyzer, let us know.

Tara Kizer
aka tduggan
Go to Top of Page

crash893
Starting Member

5 Posts

Posted - 2006-04-06 : 15:10:28
I think i should also mention that the entire database is very simple

its one table with 4 feilds

and one stroed procedure nothing else
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-04-06 : 15:33:05
Did you see my last post?

Tara Kizer
aka tduggan
Go to Top of Page

crash893
Starting Member

5 Posts

Posted - 2006-04-10 : 10:11:27
no i didnt till just now

ill try that now
Go to Top of Page
   

- Advertisement -