Showing posts with label mdf. Show all posts
Showing posts with label mdf. Show all posts

Wednesday, March 21, 2012

Retrieving Random Sections From A Data file

On my company's website, we have a quote of the day. I would like to be able to type a hundred or so quotes into a mdf file. Then, I would like to have code that randomly selects one of the quotes every day and posts it.

...What I want is very similar to the "Image Of the Day" section on many websites.

Any ideas?

Okay, I'll bite. Bear in mind that there are CMS out there that offer this - but if you want to roll your own...several approaches come to mind, so you'll want to pick the one with the best performance.Here's one - in steps. (a) Create a table with at least two fields - your quote text and an autoincrement ID (i.e. first record is 1, second is 2 etc). (b) Get the quotes into the table. (c) In your aspx, programmatically get a random integer bounded between 1 and the number of quotes you have - and select that ID from the table for display.Alternatively, have a second table that will only have one quote in it. Have your webpage simply display that one record. Create a stored procedure in the database that removes the existing record and copies in a quote from the full quote table (based again on generating a random ID - the rand() function does the trick in SQL). Then set up a daily scheduled job that calls the stored procedure which changes the quote.|||

Thanks. This looks good. Do you have any tips on what sort of code I should write to obtain the random integer?

|||

Hi,

Try this, select top 1 * from TableName order by NEWID();

Thanks.

Monday, March 12, 2012

Retrieving data from an attached mdf file

I attach my SQL Server Express data file to my host. I would like to copy all of my member information back to my local computer. How can I do this? My host won't allow my to physically copy the data file over.

My host is discountasp.net.

Thanks,
Jeff

Port 80 is obviously open, so create a web service to read the data. Lock the site to respond only to your external IP address to avoid anybody else being able to get at the data.

Retrieving data from .MDF?

Dear fellows,

Up to the moment I've got enough knowledge for read data stored into .LDF files by dbcc log and so on. It's very useful and interesting. Now, I wonder how to retrieve the same information but on MDF files.

At first, I want to make sure that is not possible by mean of traditional methods (dbcc or something like that) I suppose so but I'd like to hear opinions regarding that.

Thanks in advance for any idea, though or further information.

Enric,

We don't support reverse engineering the data from .mdf files in general, however we license our API's to third party vendors so that they can build tools to support these types of disaster recovery operations.

-Matt

|||Thanks a lot|||If you're just interested in poking about though, checkout this link.