Hi All,Hope you can help me with a problem that I have no clue how to solve without using a cursor. I can't even come up with a could title for the topic ;-)I have a table of items that are to be played in a media player that looks something like this:CREATE TABLE [tblMediaItem] ( [pinMediaItem] [int] IDENTITY (1, 1) NOT NULL , [vcPathAndFilename] [varchar] (100) COLLATE Latin1_General_CI_AS NOT NULL , [flDisplayDurationSecs] [decimal](18, 0) NOT NULL , CONSTRAINT [PK_tblMediaItem] PRIMARY KEY CLUSTERED ( [pinMediaItem] ) ON [PRIMARY] ) ON [PRIMARY]GO
The data could be something like this:INSERT INTO tblMediaItem (vcPathAndFilename, flDisplayDurationSecs) VALUES ('path1', 15)INSERT INTO tblMediaItem (vcPathAndFilename, flDisplayDurationSecs) VALUES ('path2', 30)INSERT INTO tblMediaItem (vcPathAndFilename, flDisplayDurationSecs) VALUES ('path3', 15)INSERT INTO tblMediaItem (vcPathAndFilename, flDisplayDurationSecs) VALUES ('path4', 15)INSERT INTO tblMediaItem (vcPathAndFilename, flDisplayDurationSecs) VALUES ('path5', 15)INSERT INTO tblMediaItem (vcPathAndFilename, flDisplayDurationSecs) VALUES ('path6', 15)INSERT INTO tblMediaItem (vcPathAndFilename, flDisplayDurationSecs) VALUES ('path7', 15)
For whatever reason I only want to play X seconds worth of content at any one time. So If I only want to get the first 60 seconds worth of content I could loop through the items using a cursor and put each row into a temporary table variable until I get 60 seconds worth with a simple IF statement in the loop.In reality the table will hold a lot more than just a few rows and I will maintain a record of where I was up to and things like that so that I don't play the same items over and over. So, is it possible to do this without using a cursor?Thanks for your timeKeith