|
So, the .MDF file is damaged or missing, but you still have the .LDF? As long as your database was using the Full recovery model, and you have any log backups you've made since the full backup, you can get it back.
Step one - back up the transaction log in SQL Server. Be sure to set the NOTRUNCATE option so that the committed transactions are not removed. Then restore the full backup with the NORECOVERY option. Now restore each previous log backup again with the NORECOVERY option. Finally restore the log backup you just made, this time allowing SQL Server to perform recovery.
The database should now be in a consistent state, and should contain the result of all transactions that had been committed up to the point of failure.
It's worth testing this out on another database, on another server, before you start trying to recover the one you're having a problem with, to ensure you don't make any mistakes. Also consider stopping SQL Server and making a file-level backup of the affected files.
If you're using the bulk-logged recovery model, the log backup operation will need access to any pages in the data file that were changed by any bulk operation. If these pages are unreadable or damaged, the log backup will fail and you won't be able to recover the database to the point of failure. If you're using the Simple recovery model, the transaction log only contains the most recent transactions, it does not represent a complete history. Therefore it cannot be used to recover to point of failure.
|
|
|
|
|
Thankx for your valuable reply...
i want to know answer..
1. can i read the LDF file content ??? how ???
please help...
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
There is a tool called Log Explorer[^] you can obtain - there is a trial version available from the Downloads section if you register.
|
|
|
|
|
Hi All,
I have created of freetextsearch catalogue based on three columns of datatype nvarchar, col1,col2,col3 now i want to implement this type of logic in freetext search.
If there there is a entery like , "visual C","some value",""
Now if provide this type of syntaxe in query like Contains((col1,col2,col3),@Keyword) and parameter have visual it will return me this row, but if i provide like this "ual C" it will return no row. i want to implement this type of search
"Logic should be so that if the typed in characters is contained anywhere in the course col1/col2/col3 it should be found.
"
Thanks if advance for help.
Many Thanks & Best Regards,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
adnanrafiq wrote: Contains((col1,col2,col3),@Keyword)
Contains(col1,@Keyword) OR Contains(col2,@Keyword) OR Contains(col3,@Keyword)
|
|
|
|
|
Thanks for Reply, but it will not work for me.
I want same behaviour from freetext serach using freetext or contains predicate, just like '%isual%', the syntaxt you provided will failed for me,
For Example:
let say have table name "table1" having one column "Col1" and table has these values
visual C#
C++
Adobe Photshop
SQL Server
Basic Language
MY SQL
HR Questions
MBA (Marketing)
Here is variable in Store Procedure:
-------------------
DECLARE @KEYWORD NVARCHAR(MAX)
SET @KEYWORD ='Visual';
SELECT * FROM TBALE 1 WHERE Contains(Col1,@KEYWORD)
IT WILL RETURN ME Only one Row Visual
--------------------
SET @KEYWORD ="visu";
SELECT * FROM TBALE 1 WHERE Contains(Col1,@KEYWORD)
if i use this change the variale value to "visu" it wil return me no row
---------------------------
SET @KEYWORD ="sual C#" ;
SELECT * FROM TBALE 1 WHERE Contains(Col1,@KEYWORD)
and if i again change value of vairable to "sual C#" then again no result.
-----------------------------
I want result in these two cases,is the possible.
Again THANKS IN ADVANCE
Many Thanks,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Dear All,
I am using Sql server 2005
I would like to know Is it possible to use switch case(like we do in C#) in stored procedure.if not what if alternative of that. Because based on input parameter I would like to perform different action
Please guide me or give me some useful link.
Thanks
regards
imran khan
|
|
|
|
|
|
sql actually has a very poor switch statement. It can only be used in select statements. It looks like this:
Select case
when col1 = 1 then 'true'
when col1 = 0 then 'false'
else 'false'
end -- case
from table1
You can also do:
Select case col1
when 1 then 'true'
when 2 then 'false'
else 'false'
end -- case
from table1
If you are just taking about program flow without select statements all you can use is if and else if statements.
Hope that helps.
Ben
|
|
|
|
|
Hi
I want to calculate the space occupied by an individual row in a table.
Thanks
|
|
|
|
|
Space means bytes or number of tuples which exists?
|
|
|
|
|
Hi
Thanks for reply . I want to calculate space in bytes.
Thanks
Bhaskar
|
|
|
|
|
Hai Buddy,
Cool u can do it as following;)
Find length of data stored in row of SQL Table
select datalength(sizeofrow) from tablename where i = 1
i=1 is kinda condition for fetching row...which u want....
best luk
vishu
Vishu Gurav
University of Nebraska-Lincoln
|
|
|
|
|
Hi,
Thanks for reply, But the query you have given is not working. It is giving Invalid column name 'sizeofrow'. Error
Thanks
vijay
|
|
|
|
|
Oh my apologies you need to have coulumn of that name I think.
Why dont you add one more coulmn name as sizeofrow with varchar(20) datatype.
this will work i believe if not please refer here:
http://blogs.msdn.com/sqltips/archive/2006/07/14/666188.aspx
Thanks,
Vishu
Vishu Gurav
University of Nebraska-Lincoln
|
|
|
|
|
Did u get it wrked?
Vishu Gurav
University of Nebraska-Lincoln
|
|
|
|
|
Hi, I have simple table1 like this:
name type value
-----------------------
aa A 0.1
aa B 0.2
aa C 0.3
bb A 0.4
bb B 0.5
bb C 0.6
Then, I doing the code from Krish
SELECT nama,
CASE WHEN test_type = 'A' THEN value ELSE 0 END AS 'A',
CASE WHEN test_type = 'B' THEN value ELSE 0 END AS 'B',
CASE WHEN test_type = 'C' THEN value ELSE 0 END AS 'C'
FROM table1
But the result is:
name A B C
--------------------------
aa 0.1 0 0
aa 0 0.2 0
aa 0 0 0.3
bb 0.4 0 0
bb 0 0.5 0
bb 0 0 0.6
But, I'm expecting table like this:
name A B C
--------------------------
aa 0.1 0.2 0.3
bb 0.4 0.5 0.6
Thanks a lot !!!
|
|
|
|
|
Hi, I have simple table1 like this:
name type value
------------------
aa A 0.1
aa B 0.2
aa C 0.3
bb A 0.4
bb B 0.5
bb C 0.6
Then, I doing the code from Krish
SELECT nama,
CASE WHEN type = 'A' THEN value ELSE 0 END AS 'A',
CASE WHEN type = 'B' THEN value ELSE 0 END AS 'B',
CASE WHEN type = 'C' THEN value ELSE 0 END AS 'C'
FROM table1
But the result is:
name A B C
-------------------
aa 0.1 0 0
aa 0 0.2 0
aa 0 0 0.3
bb 0.4 0 0
bb 0 0.5 0
bb 0 0 0.6
But, I'm expecting table like this:
name A B C
-------------------
aa 0.1 0.2 0.3
bb 0.4 0.5 0.6
How a resolve this problem, need your help.
Thanks a lot !!!
|
|
|
|
|
A client sent me a backup copy of his database so that I could debug a stored procedure.
After I restored the .bak file into my copy of SQL Server 2005, I see that it renamed every table by prepending the original name of the database to each table name.
So now every table must be referred to by "schema.tablename" instead of just "tablename". This breaks every stored procedure in the database because they all still refer to the tables by their old names.
Why does it insist on renaming the tables, and how do I get it to stop doing that whenever I restore a database from a .bak file?
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I've never seen it do that before ... I've always restored databases back to databases with the same name and it works fine.
|
|
|
|
|
I am in the proccess of writing a small membership program and all the info is being stored in an MS Access database. I've gotten stumped on coding the datagridview's "DataRelation" object because I'm having to code through three table levels.
To explain, I want to create families (Father, Mother, Children) and link them through the DataGridview.
I have a master table called "tblFamilyNames" that holds the "primary key" and anniversary date. I then have a table called tblFamilyDetails. It links the family(Father, Mother, Children) together by storing the primary key value from tblFamilyNames in a column called "intFamilyID".
In tblFamilyDetails, there is a column: "intMemberID" that points to a record in the third table: tblMembers".
My question is, how do I bind the first table: "tblFamilyDetails" with the third table: "tblMembers" so that the user can see the member's info without seeing the intermediate table: "tblFamilyDetails"?
may your code be error free
|
|
|
|
|
This may not be the answer that you're expecting, but have you considered using Views to de-normalize the data? It sounds like you could create a "Family" view that is an INNER JOIN of tblFamilyNames and tblFamilyDetails. This could then be JOINed to tblMembers to give you a single unified view of the data.
Cheers!
Humble Programmer
,,,^..^,,,
|
|
|
|
|
Hi
I have a problem with INSERT,UPDATE table when working with ODBC in DotNet.
if you go to the following link and fill all the field and then click button see the error .i can not solve this.
http://www.bastanbar.com/ViewOrders.aspx
my connection string is in the following function
<br />
Public Shared Function GetConnection() As OdbcConnection<br />
Dim myConn As OdbcConnection<br />
Dim connStr, path As String<br />
Dim Request As System.Web.HttpRequest<br />
path = HttpContext.Current.Request.PhysicalApplicationPath()<br />
path = path + "data.mdb"<br />
connStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" + path + ";ReadOnly=0;"<br />
myConn = New OdbcConnection(connStr)<br />
Return myConn<br />
End Function<br />
when i try to add one record to my table an error ocures
"ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query"
please help me to solve this problem
|
|
|
|
|
What does your INSERT query look like?
|
|
|
|
|
Hi martin
My INSERT query is in the following function
<br />
Public Function SaveTransInfo(ByVal idrequestman As Long, ByVal iddestinationInfo As Long, ByVal Y As String, ByVal M As String, ByVal D As String, ByVal Goods As String, ByVal idworker As Byte, ByVal Tonaj As Double, ByVal place As String, ByVal sdate As String) As Boolean<br />
Dim sqlStr As String<br />
Dim myCon As OdbcConnection = GetConnection()<br />
sqlStr = "INSERT INTO TransInfo(idrequestman,iddestinationInfo,Y,M,D,Goods,idworker,Tonaj,place,sdate) VALUES(" + idrequestman.ToString & "," & iddestinationInfo & ",'" & Y & "','" & M & "','" & D & "','" & Goods & "'," & idworker.ToString & "," & Tonaj.ToString & ",'" & place & "','" & sdate & "');"<br />
Try<br />
Dim myCommand As New OdbcCommand(sqlStr, myCon)<br />
myCon.Open()<br />
myCommand.ExecuteNonQuery()<br />
Catch ex As Exception<br />
myCon.Close()<br />
HttpContext.Current.Response.Write(ex.Message)<br />
Return False<br />
End Try<br />
myCon.Close()<br />
Return True<br />
End Function<br />
<br />
thanks for your attention<br />
<br />
|
|
|
|
|