|
|
Hi i have a file with extention .sql which has DBscripts for my database. How can i restore the database using these scripts.
|
|
|
|
|
Restore an empty db or with data ?
You could always use the command prompt "osql" (see sql server books online)
and create a restore.bat file.
or
Use Integration Services to run the scripts if you want an automatic restore.
or
simply run the queries
|
|
|
|
|
Hi... I have a table with a column containing images. I'd like that my sql server 2005 stores those images on his backup device.
I tried with the following command
EXEC xp_cmdshell 'bcp "SELECT Image FROM table WHERE ID=1" queryout "C:\Temp\myImage.jpg" -c -T'
I get a file that seems a jpg image... but it's not... I think it's because bcp queryout works only with text data.
Does somebody have any idea on how can I get this working?
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
bcp is not adequate for that, you may need to use textcopy utility.
e.g.
textcopy /S server /U username /P password /T table /D databasename /C Image /W "WHERE ID=1" /O /F C:\Temp\myImage.jpg
|
|
|
|
|
Hi...
tanks a lot for your answer... The only problem is that Textcopy is not supported in sql server 2005 http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=708866&SiteID=1[^]
It was a sql 2000 utility... and I cannot go to all my clients telling that they have to copy Textcopy.exe on their server
#@|°@#@¬@#°§@ Microsoft :-S
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
In this case you could
1. either use SSIS's Export Column task to put the binary data into an image file (http://technet.microsoft.com/en-us/library/ms139818(SQL.90).aspx).
2. investigate the possibility of writing a little CLR to do that job.
if neither is possible check this post which uses sp_OA* (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=101754)
|
|
|
|
|
Hi...
Tank you for your answers... I tried another solution: with bcp I temporarily store a vbscript file where I have the code to connect to the database, select the image and store it in the file I want.
I then call it using the following command
EXEC xp_cmdshell 'cscript "C:\temp\StoreImage.vbs"'
It works very well with SQL Server 2005 in any configuration. But when I try with a SQL Server 2005 Express Edition, when I use trusted connection, the script fails getting an "Access denied" error.
Should I change something in the rights of the sqlserver account? but what?
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Found my own response:
USE[DataBase]
GRANT CONNECT TO [guest]
GRANT SELECT TO [guest]
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
hi,
search here in codeproject, there´s a lot of code samples on storing images in database.
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
I don't wanna store images in database... that's already done and it's easy stuff!
What I wanna do is to have the database exporting a picture from a table to a folder of the server (i.e c:\temp\myimage.jpg)
I've googled around and found this textcopy... but as said in the previous post, it's not distributed by sql server 2005
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Hey joZ, how come???
i store images in database (from pictureboxes) and i load then into pictoreboxes!!! that´s easy stuff to!!!
Doesn´t it works the same way in webforms?
What i have here is a byte[], i post it if you want, i grabbed that here, did my changes too.
Are you sure that, you dont have already the code for that?! i think so.
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
It's not this the problem...
I have a windows application, where I put and receive images in pictureboxes from an sql server (wich naturally can be located on another pc).
Now I have the need that this server take the pictures from the table and put them in his c:\temp ... and this with bcp does not work...
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Wow - I would not have even considered that BCP could extract binary data. I'm pretty sure this is well outside the capabilities of BCP (or bulkcopy for that matter).
BTW what happens when you write a datatable to xml if there is an image field in the table?
Why would you use BCP for backup of a database. I would have thought standard or compressed (Red-Gate) backup would be a better solution.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Sorry, its too much to do in a forum, and you have not supplied enough information either. Try getting a book on database design, there are hundreds around. Then, if you have specific questions come back with them.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
developer.ravish wrote: I have 2 develop and design a database for customer feedback survey?
First, is it any harder to type "to" rather than "2". Seriously. This is a site for professional and aspiring software developer, not Califonian teenage valley girls.
First off is that you need to get some requirements from your client. Feedback surveys are usually designed by the marketing department as they are the ones that want to know how effective their marketing is. They are the people you need to speak to first. They don't understand databases so asking them about columns, primary keys, foreign keys and database relationships isn't going to work.
You have to find out what information they want to collect. Do they have a sample form that will be filled in? If so that is a good starting point for the data they want to collect.
If there is a question that requires a score then your database needs a numeric column somewhere. If it is free text, then you need an ntext or nvarchar column. And so on...
|
|
|
|
|
u r a genrus fellw *smack*
Sorry
A genuinely helpful answer, have well... Helpful
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
|
Although you have managed to cover the most important bit up, I suspect you are trying to log in with sql server authentication, not windows.
Otherwise, the message is pretty clear - it tells you what the problem is.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I am using SQL 2005 and VS2008. What I want to do is that I want to Insert, Update and Delete data from database using DataGridView. How can I do this? Please Help.
|
|
|
|
|
|
Hey guys, I'm planning to start working on a software which requires a huge database, this database has pictures, text files, PDF files, mp3 files and probably movies files, it would also have information to which these files are related to ! so saving all of them in SQL would be too space consuming, so how would you design such database if u were me ! would u programatically save the huge files on the hard drive of the client or would u save them all in SQL ?
Thanx in advance
Mr.K
|
|
|
|
|
This would depend on several different factors. Have a look at SQL Server 2008 and especially:
- Compressed Storage of Tables and Indexes
- FILESTREAM Storage
- Table partitioning
The need to optimize rises from a bad design
|
|
|
|