Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Pass values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bbawa1@yahoo.com - 18 Jun 2007 23:53 GMT
I have the following Stored procedure.  There is column named
"tcktreceived" in my database and I want to pass all the rows one by
one to the parameter @starttime.  I don't know how to do it.

CREATE PROCEDURE [twcsan].[usp_DateDiff]
    -- Add the parameters for the stored procedure here
    @starttime DateTime

AS
BEGIN
DECLARE @Diff Varchar(15)
DECLARE @Day INT
DECLARE @Hour INT
DECLARE @Minute INT
DECLARE @Start_Date DateTime
DECLARE @End_Date DateTime
DECLARE  @itemReceived DateTime
DECLARE @ID INT
DECLARE @message VARCHAR(50)

DECLARE @table TABLE
(
 ItemReceived DateTime,
 ID INT,
 message text,
 Differnce VARCHAR(20)

)
    SET NOCOUNT ON;
 SET @Start_Date = @starttime

SET @End_Date = GETDATE()
SET @Day = DATEDIFF( day, @Start_Date, @End_Date)
SET @Hour = DATEDIFF(hour , @Start_Date, @End_Date)
SET @Minute = DATEDIFF(minute , @Start_Date, @End_Date)
SET @Minute = @Minute-(@HOUR* 60)
SET @Hour = @Hour-(24* @Day)
SET @Diff = CONVERT(Varchar, @Day) +'d ' + CONVERT(Varchar , @Hour) +
'h ' + CONVERT(Varchar , @Minute) +'m'

INSERT INTO @table(ItemReceived, ID, message, Differnce)
select tck.tcktreceived, tck.ticketid,tckmsg.tcktmessage,@Diff
from tbtickets tck inner join  tbticketsmessages tckmsg
on tck.ticketid = tckmsg.ticketid

select * from @table

END
Josh - 19 Jun 2007 09:54 GMT
I'm not sure what your after, but try looking at using "Cursor" that might
give you what you need.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.