Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i Have a File i want to store the file in the format of xml , which can access or load from Database when it is required , any One help me with sql server code , it saves me lot of time and codeing for my developemnt project should be like

What I have tried:

Hi Have a File i want to store the file in the format of xml , which can access or load from Database when it is required , any One help me with sql server code , it saves me lot of time and codeing for my developemnt project
Posted
Updated 27-Jan-21 5:44am
Comments
RedDk 27-Jan-21 12:05pm    
Consult the help document for your root installation. That's the "Book On Line" which has to be obtained from MS. Lookup "XML". Read about all things TSQL in that "BOL".

You know, once you code something to do something and it works as you want it to work, you can save that code, make copies of it, store the copies ... then after you build up a store of code that works ... even search through it usg keywords that are found in that BOL, you're all set. You don't have to code again. So you're efforts become you're own answers.

Once you write some code and it works, you never have to do anything with it. Not even "know" what it was you did in the first place: just look the keyword up in your storage and determine whether something you wrote is suitable to use in your new procedure/method/function/etc.

Fantastic or what?

You can save it to disk and store its address in the database. Or, if it is not too large just store it in a varchar field.
 
Share this answer
 
Comments
saagarchary 27-Jan-21 8:33am    
can u please post the sql query
Richard MacCutchan 27-Jan-21 9:11am    
What query?
If you mean you want to store an XML file in a single column of a row in an SQL table, then just pass it via a parameterized query to a NVARCHAR(MAX) column. Retrieve it by SELECTing it as you would any other text. We can't give you any idea of the code you'd need as we have no idea even what language you are using, much less the environment it will run under!

XML isn't magic: it's a text-based, human readable format that is "just another string" as far as SQL is concerned.

If that isn't what you mean, we would need a lot more information in order to answer.
 
Share this answer
 
If the content of the file is XML, why not store it in an XML field inside the SQL database. Have a look at XML Data Type and Columns (SQL Server) - SQL Server | Microsoft Docs[^]
and Create XML Data Type Variables and Columns - SQL Server | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900