|
I don't know a way to do what you require using SQL/T-SQL but it can definitely be done using SMO (Example of a C# utility using SMO to script indexes[^]) or a combination of SMO and PowerShell.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Try Like this in Your SP
If You Know all the Database Names.
select t.name, i.name
from DatabaseName1.sys.tables t, DatabaseName1.sys.indexes i
where i.object_id = t.object_id
union
select t.name, i.name
from DatabaseName2.sys.tables t, DatabaseName2.sys.indexes i
where i.object_id = t.object_id
Regards
Senthil Raja.J
modified on Thursday, December 30, 2010 4:34 AM
|
|
|
|
|
Please wrap the code in PRE tag.
|
|
|
|
|
For few of us, its seems to be a simple question, I already have a solution for this...
I don;t need solution, I need explanation.
Problem:
I'm trying to backup the database by selecting the database source, backup type = full, name the backup set, and leave the rest as default. The backup seems to be successful.
The problem comes when I need to restore the backup database.
I 've tried many times and a few different kinds of selection, all fails. I've selected the source for restore from device, that is the .bak file from backup folder and remains the rest of selection as default. Here is the error message I get:
System.Data.SqlClient.SqlError: The backup set holds a backup of the database other than the existing 'testing' database. (Microsoft.SqlServer.Express.Smo)
I know the solution to this:
In Restore window-> Options tab, check "Force restore over existing database"
I need why should I check force restore.
Can some one please explain?
G-U-R-U
|
|
|
|
|
|
As per the above mentioned link ....
Force restore over existing database means if a database already exists with the same name that you are restoring, then overwrite it. If one doesn't exist, just create it.
But for mine case, I don;t have any existing database and still I'm getting the error.
G-U-R-U
|
|
|
|
|
In a simple file copy pasting scenario what happens ?
If you're pasting file at the location where file with the same name exists there, They will ask you whether you want to overrite it ?
Same happens with DB, If you're restoring DB that sets is already existed in DB then you need to override it rather then creating duplicate DBs.
I hope you get your answer.
|
|
|
|
|
I agree with you.
But in mine case, I don;t have any DB with same name.
I just got a BAK file from some other server and tried to restore the same on another server.
G-U-R-U
|
|
|
|
|
All records of some of tables in my database were deleted. Database is for a website on internet. Can anyone help me with some hints and a solution . This happened just today. Can I restore my lost records without a backup file ? Is there a way to find out how this happened ? (hacked ? exceeding db size limit ? ... )
|
|
|
|
|
|
|
I don't know a way to read the log file. And the only tool i know which can
possibly help you is Apex SQL Log.
G-U-R-U
|
|
|
|
|
devboycpp wrote: Can I restore my lost records without a backup file ?
No, however depending on how the data was deleted, it still may exist on the disk. You might want to see if there are any tools available to recover sql server data on a hard drive.
devboycpp wrote: Is there a way to find out how this happened ?
There may be. I would start with any logs you have at your disposal. Check the Web Server logs, the SQL logs, Audit logs, the SQL Server Service logs.
If you can not find anything there, look at how you insert, update and delete data from the affected tables for bugs.
Check the web code for possible sql injection.
|
|
|
|
|
All depends on the recovery model.
if you have a "full" recovery model then use a third party product to do if for you
how do i recover data from sql server s log files[^]
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
I am not sure if this is the correct category to post my question.
I am now currently using netbeans, java db and glassfish.
i want to display values from the database in the table.
so i drag the table from the database to the table.
However i get the following:
http://img80.imageshack.us/img80/2290/whylikethis.png
why is this so? it just kept refreshing and i am unble to edit the values that i wanna display on the table.
|
|
|
|
|
pancakeleh wrote:
http://img80.imageshack.us/img80/2290/whylikethis.png
The link which you mention here is not working whatever,
I am suggesting you to Move Java Forum and mention code if it not working or giving error.
|
|
|
|
|
It's a java question. You should have posted in java forum. Also you should have post the code here which you have tried so that we can at least guess the thing. And then what database? Also your image link is broken(it's redirecting to this forum) but I can see the image by pasting the link text http://img80.imageshack.us/img80/2290/whylikethis.png, so here after correct that. cheers.
|
|
|
|
|
Hey guys,
I've made this simple, as you can see in the picture I have some categories and subcategories, in this case
Electronics > Television (check out this to understand better http://i56.tinypic.com/rmvifs.jpg)
Television is a type of product which has some fields like (size, color, brand) that has to be saved in the database. there are many different types of products which have their own fields and their number is unknown therefore this cannot be done statically, it has to be done dynamically.
in addition to all this, each field has values, there are three types of values
true/false
multiple choice
single text
the values for each field also needs to be stored in the database so when for instants TV is selected the fields are loaded + their values.
I hope I were clear enough, would appreciate it if you could help out with the best design
K1
|
|
|
|
|
Could you please look into link you provided ? It's not redirecting properly.
|
|
|
|
|
If you cut and paste the link, it seems to work. Anyway this might help.[^]
Unfortunately, it looks remarkably like a lecturer's whiteboard with a homework problem, snapped on a mobile 'phone, but I could be wrong.
|
|
|
|
|
it actually is my whiteboard and that's the problem I wanna find a solution for !
so have you got any idea guys ?
|
|
|
|
|
Well, I wouldn't tackle the problem that way at all. Assuming you are using a 'grown up' database, and you don't have millions of records under 'Electronics', then I would just have two tables.
The first would hold the records of all the 'Electronics' items, with a 'Category' column containing a unique code for TV, DVD player and so on. Other than the essential columns, like Name etc, I would have Descr1, Descr2, Value1, Value2, etcetera, enough to accommodate the most complex item. Some columns would have normal names, for instance, 'Price', or 'Cost'.
The second table would reference the first through the Category Code, have the same columns and column headers as the first table, but the rows would each contain descriptive values for the equivalent column headers in the first table.
|
|
|
|
|
I am still out of luck, I am not getting to see image.
Thanks for all your work.
|
|
|
|
|
So sometimes I use bcp from my c# and call it in a separate process while passing it command line arguments. I have been doing this for months, but today it started throwing an ambiguous error. I have changed nothing, so the sudden failure is proving difficult to resolve. I am still able to create the bcp format file, but when I try to insert a file I get:
An error occurred while processing the command line.
bcp PriceRecords.dbo.SVR5 in "C:\Code\b
in\debug\SVR5\1220201093611.csv" -t',' -f "C:\Code\bin\Debug\SVR5.xml" -U xxxxxx -P xxxxxxn -S localhost\SqlExpress
where xxxxxx = user and password
Using MSSQL 2008, not seeing any error in the SQL logs.
|
|
|
|
|
It appears wrapping the table name in brackets fixed this issue. I have no idea why this error seemed to have spontaneously started.
|
|
|
|