Showing posts with label mssql. Show all posts
Showing posts with label mssql. Show all posts

Monday, March 19, 2012

Cannot Open .bak File from ms sql database. either 2000 or 2007

Can not open mssql .bak file in ms_sql. File starts with "ti" and some
weired charctor. Can some one help me on how to open this back up of
mssql database. I've tried to restore this file in mssql and it says it
does not recognize this file. I understand that .bak file for mssql
should start with "tape". But when i opened this file in ms excel it
show the file starting with "ti" not tape.

Any help on this would be appreciated and please let me know if you
need access to file.

Thanks(Rizwan.Bakhshi@.gmail.com) writes:

Quote:

Originally Posted by

Can not open mssql .bak file in ms_sql. File starts with "ti" and some
weired charctor. Can some one help me on how to open this back up of
mssql database. I've tried to restore this file in mssql and it says it
does not recognize this file. I understand that .bak file for mssql
should start with "tape". But when i opened this file in ms excel it
show the file starting with "ti" not tape.
>
Any help on this would be appreciated and please let me know if you
need access to file.


I will have to admit that I did not know about the TAPE thing, but I
looked at some backups, and indeed they had TAPE in the beginning.
Except one from SQL 6.5, which had MSSQL.

Anyway, with the information that .bak file could be anything. Or do
you have a special reason that it is an SQL Server backup file?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Friday, February 24, 2012

Cannot insert explicit value for identity column in table SS_Messeges when IDENTITY_INSERT

I use SQLExpress2005 and I search about this problem , this is a BUG in MsSql 2000 but I use sql Express 2005.

although in my table I set IDENTITY_INSERT on (master Key)

Please help me

I don't quite understand what your problem is. Have you tried "Set identity_insert SS_Messages ON" and still after setting this you're not able to insert explicit value in your table ? Can you explain your problem further ?

|||

let's me explain the my problem

I design a Messages table width this columns

MessageID >> int - MasterKey - Is Identityyes- Identity Increment1 - Identity seed1 NOTNULL

MessageTitle >> nvarchar(256) NOTNULL

MessageBody >> ntext NOTNULL

AddedDate >> dateTime NOTNULL

AddedByIP >> nvarchar(256) NOTNULL

IsRead >> bit NOTNULL

ResName >> nvarchar(256) NULL

ResMail >> nvarchar(256) NOTNULL

my Insert producer

ALTER PROCEDURE dbo.SS_Messages_InsertMessage
(
@.MessageTitle nvarchar(256),
@.MessageBody nvarchar(256),
@.AddedDate datetime,
@.AddedByIP nvarchar(256),
@.isRead bit,
@.ResMail nvarchar(256),
@.ResName nvarchar(256),
@.MessageID int OUTPUT
)
as
SET NOCOUNT ON
insert into SS_Messeges
(MessageID,MessageTitle,MessageBody,AddedDate,AddedByIP,isRead,ResMail,ResName)
VALUES (@.MessageID,@.MessageTitle,@.MessageBody,@.AddedDate,@.AddedByIP,@.isRead,@.ResMail,@.ResName)
SET @.MessageID=SCOPE_IDENTITY()

DAL Message class (Insert Message methods)

public override int InsertMessage(MessageDetails message)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("SS_Messeges_InsertMessege", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@.MessageTitle",SqlDbType.NVarChar).Value=message.MessageTitle;
cmd.Parameters.Add("@.MessageBody", SqlDbType.NVarChar).Value=message.MessageBody;
cmd.Parameters.Add("@.AddedDate",SqlDbType.DateTime).Value=message.AddedDate;
cmd.Parameters.Add("@.AddedByIP",SqlDbType.NVarChar).Value=message.AddedByIP;
cmd.Parameters.Add("@.isRead",SqlDbType.NVarChar).Value=message.IsRead;
cmd.Parameters.Add("@.ResMail", SqlDbType.NVarChar).Value = message.ResMail;
cmd.Parameters.Add("@.ResName", SqlDbType.NVarChar).Value = message.ResName;
cmd.Parameters.Add("@.MessageID", SqlDbType.Int).Direction = ParameterDirection.Output;
cn.Open();
int ret = ExecuteNonQuery(cmd);
return (int)cmd.Parameters["@.MessageID"].Value;
}
}

BLL Messages Class >> Insert Message Methods

public static int InsertMessage(string messageTitle, string messagebody,
string resMail, string resName)
{
messageTitle = BizObject.ConvertNullToEmptyString(messageTitle);
messagebody = BizObject.ConvertNullToEmptyString(messagebody);
resName = BizObject.ConvertNullToEmptyString(resName);
resMail = BizObject.ConvertNullToEmptyString(resMail);
MessageDetails record = new MessageDetails(0, messageTitle, messagebody, DateTime.Now, BizObject.CurrentUserIP,
false, resMail, resName);
int ret = SiteProvider.Messages.InsertMessage(record);
return ret;
}

Contact US Code Behind

protected void txtSubmit_Click(object sender, EventArgs e)
{

int ret = Message.InsertMessage(txtTitle.Text, txtBody.Text, txtResMail.Text, txtResName.Text);
}

What is wrong??

when I want to add an Message this error happened :(

Cannot insert explicit value for identity column in table 'SS_Messeges' when IDENTITY_INSERT is set to OFF

|||

You want to insert and return the new ID? It doesn't look like you are supplying a value for the MessageID that you are trying to insert.

If that is the case, you can take the @.MessageID out of the insert statement. You're not really inserting anything into that field. YOu want SQL server to create the next ID for you.

SET NOCOUNT ON
insert into SS_Messeges
(MessageTitle,MessageBody,AddedDate,AddedByIP,isRead,ResMail,ResName)
VALUES (@.MessageTitle,@.MessageBody,@.AddedDate,@.AddedByIP,@.isRead,@.ResMail,@.ResName)
SET @.MessageID=SCOPE_IDENTITY()

|||

thank Pyre

I catch my problem with your post

|||

An identity column, by design, autogenerates its own value when an insert is performed. Apparently, your code must be including the IDENTITY column in the insert and supplying a value. I presume that this is NOT what you want to do.

Sunday, February 19, 2012

cannot import table in management studio wizard. ODBC Error

Im using the Tasks/Import wizard in Management Studio for a 2005 MSSQL to import a table from another database, same MSSQL server

on my machine im having: mssql 2000 (default instance), mssql 2005. 2000 is not running, only 2005.

(by the way: all .net tools like Management Studio, Database explorer in VS 2005 and so on NEVER find the 2005 instance in the combo for available servers ! i always have to enter it manually)

I am always getting:

Operation stopped...

- Initializing Data Flow Task (Success)

- Initializing Connections (Success)

- Setting SQL Command (Success)

- Setting Source Connection (Error)

Messages

The connection "SourceConnectionOLEDB" is not found. This error is thrown by Connections collection when the specific connection element is not found.
({3A6A6A25-FF8B-4E17-B2A9-C0181A291B5D})

I tried all scenarios:

different databases / tables in same server / different servers, 1 talbe, many....

it always stops there !

What do I have to do ? It is impossible to work like that !

thanks in advance, Michael

Is microsoft going to answer this? I have seen many posts like this but no solution?|||

They finally did after some month! in another thread

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=255347&SiteID=1

see: http://support.microsoft.com/kb/913817

hope this helps, good luck

Michael

cannot import table in management studio wizard. ODBC Error

Im using the Tasks/Import wizard in Management Studio for a 2005 MSSQL to import a table from another database, same MSSQL server

on my machine im having: mssql 2000 (default instance), mssql 2005. 2000 is not running, only 2005.

(by the way: all .net tools like Management Studio, Database explorer in VS 2005 and so on NEVER find the 2005 instance in the combo for available servers ! i always have to enter it manually)

I am always getting:

Operation stopped...

- Initializing Data Flow Task (Success)

- Initializing Connections (Success)

- Setting SQL Command (Success)

- Setting Source Connection (Error)

Messages

The connection "SourceConnectionOLEDB" is not found. This error is thrown by Connections collection when the specific connection element is not found.
({3A6A6A25-FF8B-4E17-B2A9-C0181A291B5D})

I tried all scenarios:

different databases / tables in same server / different servers, 1 talbe, many....

it always stops there !

What do I have to do ? It is impossible to work like that !

thanks in advance, Michael

Is microsoft going to answer this? I have seen many posts like this but no solution?|||

They finally did after some month! in another thread

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=255347&SiteID=1

see: http://support.microsoft.com/kb/913817

hope this helps, good luck

Michael