sql data base with pictures - sql-server

I'm working on a SQL server database and I need to have pictures
its for a catalog and most pictures are 1-4 mbs I don't thing embedding the pictures in SQL will be a good idea
what the best solution
till now I used to use access
I would really like to make a wpf form
but when I make a data source I don't understand exactly how linked images work
my main point is that I need it to run really quick and print out a catalog with inventory info each day for thousands of items
I'm looking for a form to manage it
I have tried an access form but access doesn't handle good the linked pictures

Just store the path to the image in the database.
Or, if using SQL 2008 or higher, there is also a new table called FileTable that stores data in the file system directly.
http://msdn.microsoft.com/es-es/library/ff929144.aspx
"I need it to run really quick" If speed is a must, Access might not be a good choice for this.. You should use a more professional RDBMS, IMHO.

If this is a hobby project I'd suggest using sqlserver express (I assume you have microsoft knowledge) and either storing a link to an image on the file system/web server or storing the object in the db. For small data volumes either way is likely to perform fairly well.

It is all very easy in MS Access 2010, just bind an image control to a table of paths. For example, my table is called Pictures, with the following entries.
PicturePath
Z:\Users\Fionnuala\Pictures\abc.png
Z:\Users\Fionnuala\Pictures\abc.jpg
I now just need an image control on a report bound to the table Pictures with a control source set to PicturePath, the images will be displayed.

Related

Export Outlook Emails Into SQL (Vai ACCESS?)

I have a email folder in Outlook that contains 100s of emails which record my discussions with a developer of some bespoke software. I want to import these into SQL to create a knowledge base of information that can be searched upon to extract all the decisions that we have made during the course of the 2 year project.
Having sreached the net, I found that it is very easy to dump the contents of an email folder into Access using the import data functionality. In fact I have linked the table and so believe (never used Access before!!) that I now have an Access table that is connected in 'real-time' to the Outlook folder. This is eactly what I want BUT in SLQ as this is something that I am very familiar with using.
So I have tried to import the Access database into SQL (which also appears to be relatively easy) but keep getting the message that 'The source database ...contains no visible tables or views'. Checking SQL pemissions, I am owner of this new databse.
Two questions please. First, cant believe that going through Access is the simplest way to do this and presume that I will loose the 'real-time' link - am I right? Second, given that I can see my Access database has a visible table, why am I getting the error?
The easiest and quickest way is to create a VBA macro where you can populate your SQL database from Outlook emails. You can build the table structure according to your needs and extract the required information from Outlook using VBA. I'd suggest processing emails in chunks using the Find/FindNext or Restrict methods of the Items class, so you will not reach the reference counter limit. The MailItem properties you may find described in MSDN.
BTW The internal store (if you use the cached mode) in Outlook acts like a database. So, why do you need to introduce yet a new database?

What is best way to fill in data from database (sql server 2008) to word (word 2007 / template)?

I need to read data from my DB (MS SQL server 2008) and push them into Word document (Office 2007). What is the best and fast way to do it? I have read about the problem here : support.microsoft.com/kb/316384 and here : msdn.microsoft.com/en-us/library/aa192487(office.11).aspx. I have tried to understand also use of fleXdoc, but there is almost no documentation. I do not need to use it on server, i want generate locally. I will generate maximally 10 separate documents from template at maximum 5 pages per each. (Invoice for example). Please can someone point to some how-to or sample project, as i am unable to find something usefull. Thank`s a lot.
I suggest you output text files, CSV for example, and use those for your merge data files for Word.
You could use CustomXML databinding, but you will likely need to be able to handle repeating rows of data. That can be done (see http://dev.plutext.org/svn/docx4j/trunk/docx4j/sample-docs/databinding/conventions.html ), but may be overkill for your scenario.
What about making an HTML document for your data table, and including that in your Word document as an altChunk? See http://blogs.msdn.com/b/ericwhite/archive/2008/10/27/how-to-use-altchunk-for-document-assembly.aspx
Both of these approaches work with Word 2007 or later, using docx (Open XML) as the document format.
Something to be aware of however, the approach might not work with Office 2010. MS Had to remove a lot of the Custom XML merging stuff from Word as a result of a lawsuit about the technology. Updates to Office 2007 and definitely 2010 have some parts of that XML support removed.

Export queries from SSMS to files - not the results but the query

I want to export all my queries as individual files for purposes of putting them into mercurial source control, but I don't know how to export the individual queries as individual files without having to open each one, then save to the folder, then add into the project, or some equally convoluted process.
I wouldn't mind having to add each one individually, but how do I get them out of the database as individual files without opening them all and doing each one save as? Ostensibly I would like them named with the name they have in the database right now.
I could easily dump the whole lot into one long file using database tasks, but that's not really super helpful is it?
I have SSMS 2k5 and 2k8 (and VS 2k5, 2k8, 2010 to boot) to work with, any thoughts?
Right click on the database. Select Generate Script. On the last page. Script To file you can choose single file or file per object
When you script a database in SSMS you have the option of one file per objects.
SMO is useful with a small app to iterate through
Third party tools like Red Gate SQL Compare (there are other free tools) can script too
I would write a small C# program which extracts your database object via SMO and stores them in your filesystem the way you want.
It is rather easy to write stored procedures which fetches the definition into the result as text. sp_helptext could be used as start.
Than you can use PowerShell to write the Output to the file system.
It sounds as if this would fit rather good into the Really Simple Data Dictionary codeplex project. link text

Add Database Diagram to Source Control?

Is there any way to add a SQL Server Database Diagram to source control? I can't seem to find a way to script it out of the database. If so, is there a way to get that diagram into a Visual Studio Database Project for easy deployment?
to script it to a file try:
http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx
I would not do this.
I've been allowed to publish my variation on a set of scripts that do just that, providing easy two-way import/export between files and diagrams stored in a database.
https://github.com/timabell/database-diagram-scm
Just run the batch file, pointing at your database of choice and you'll get a set of files, one for each diagram. Unfortunately the data is still binary, but it's a start.
It builds on what others have already done, definitely a shoulders of giants job. :-)
I don't know what the advantage of storing the diagram in source control would be. The database diagrams put an illustration to your database relationships which should be defined elsewhere. So long as you put the creation scripts for your DB in source safe, the diagram should render just fine when you create it and add your tables to it.
There isn't really an easy way of doing this. I typically do one of a few things for this.
Simply print the document to PDF using something like CutePDF
Use Visio and the Reverse Engineering option to generate the document, then save the visio file
Use Enterprise Architect or similar tool for the process.
I personally use option 3, due to the lifecycle that I take my applications through. But the real thing is what are you looking to store, if it is a static version of the database diagram, any of the above are valid.

Can you export packaging information (ERD or other data model) from Cognos 8.3?

I was wondering if there's a way to export package information from Cognos 8 from a regular user level or from the framework level.
For instance, I want the field names that cognos is pointing to on the database, i want the datatype, the description cognos uses when you right click a data element, etc..
Any suggestions?
(Unfortunately I'm not at my work computer right now) but Cognos saves everything in .xml files. I have an xml pretty printer that I use on model.xml before and after edits, so that I can use windiff to see what exactly changes in the model. I have also used an xml editor on model.xml on several occasions for global search and replace.
Having said that, I'm not sure how much of the database schema you can infer directly from model.xml, but I suspect if you had a script that could read and walk model.xml, and connect to the database to describe the objects, you could get what you need.
The answer appears to be yes, to anything that supports CWM (the Common Warehouse Model) but as for how...
One suggestion: ask IBM.
It appears that Powerdesigner 15 imports from xmi models.

Resources