Reputation: 15608
The web app has to let a user browse a csv file of around 100'000 lines. We have to show the contents of the file on the screen so the user can see what has been loaded. Then the user will perform some actions on the screen (e.g. add their details) We need to store the file in database and associate it with the user record
The contents and the format of the file will change per user. Therefore, I cannot create a static table in MS SQL DB for it.
Do you recommend loading this file as a blob in MS SQL 2008 DB or should I load the file, create a plain class (in C#) object that matches the file, serialise it and then store it as the xml file. Later if user wants to see it, I can read the xml string from DB, deserialise it to the object, write logic that takes the object and creates a csv file?
Is there another approach? Is storing as xml string better than storing as blob?
Upvotes: 0
Views: 411
Reputation: 1039298
You could use the FILESTREAM data type in SQL Server 2008. Behind the scenes the actual file is stored on the file system but you get fully transactional access to it and the way it is actually stored is completely transparent.
Upvotes: 2