MS SQL DataBase Vs XML Serialization

Feb 9, 2008



Hi,

I have designed a Contacts application, where I need to persist contacts to a file.

The contacts can exceed over 10,000

Which will be a better option to persist contacts to - A XML file OR SQL DataBase ?

Thanks

View 1 Replies


ADVERTISEMENT

Type TypePoint Is Marked For Native Serialization, But Field X Of Type TypePoint Is Not Valid For Native Serialization

Oct 6, 2006

I made a point type by C# for deploying in SQL2005.

It builds successfully every time.

When I deploy, it gives the following error:
"Error: Type "SqlServerProject1.TypePoint" is marked for native serialization, but field "x" of type "SqlServerProject1.TypePoint" is not valid for native serialization." although x variable is value type decimal.

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

[Serializable]
[SqlUserDefinedType(Format.Native, IsByteOrdered=true)]
public struct TypePoint : INullable
{
private bool m_Null;

private Decimal x;
private Decimal y;

public override string ToString()
{
// Replace the following code with your code

if (IsNull) // added part
{
return "null";
}
else
{
return x + ":" + y;
} // end of this part

// return "";
}

public bool IsNull
{
get
{
// Put your code here
return m_Null;
}
}

public static TypePoint Null
{
get
{
TypePoint h = new TypePoint();
h.m_Null = true;
return h;
}
}

public static TypePoint Parse(SqlString s) // Most Important Part
{
if (s.IsNull)
{
return Null;
}
else // added part
{
TypePoint p = new TypePoint();
string str = s.ToString();
string[] xy = str.Split(':');
p.x = Decimal.Parse(xy[0]);
p.y = Decimal.Parse(xy[1]);
return p;
}
}

public Decimal X
{
get
{
return x;
}
set
{
x = value;
}
}

public Decimal Y
{
get
{
return y;
}
set
{
y = value;
}
} // end of added part

// This is a place-holder method
public string Method1()
{
//Insert method code here
return "Hello";
}

// This is a place-holder static method
public static SqlString Method2()
{
//Insert method code here
return new SqlString("Hello");
}

// This is a place-holder field member
public int var1;
}

View 4 Replies View Related

Binary Serialization

Mar 9, 2007

Hello,I am trying to serialize (binary) a class and save it in a database. I followed a few examples I found in internet and this is what I came up with: 1 ' Rows
2 <Serializable()> _
3 Public Class Rows
4 Implements ISerializable
5
6 Private _Rows As New Generic.List(Of Row)
7 Public Property Rows() As Generic.List(Of Row)
8 Get
9 Return _Rows
10 End Get
11 Set(ByVal value As Generic.List(Of Row))
12 _Rows = value
13 End Set
14 End Property ' Rows
15
16 ' New
17 Public Sub New()
18 End Sub ' New
19
20 ' New
21 Public Sub New(ByVal siRows As SerializationInfo, ByVal scRows As StreamingContext)
22 End Sub ' New
23
24 ' GetObjectData
25 Public Sub GetObjectData(ByVal siRows As SerializationInfo, ByVal scRows As StreamingContext) Implements ISerializable.GetObjectData
26
27 siRows.AddValue("Rows", Me.Rows)
28
29 End Sub ' GetObjectData
30
31 Public Sub Serialize(ByVal filename As String)
32
33 Dim sRows As Stream = Stream.Null
34 Try
35 sRows = File.Open(filename, FileMode.Create, FileAccess.ReadWrite)
36 Dim bfRows As New BinaryFormatter
37 bfRows.Serialize(sRows, Me)
38 Finally
39 sRows.Close()
40 End Try
41
42 End Sub ' Serialize
43
44 Public Shared Function Deserialize(ByVal filename As String) As Rows
45
46 Dim sRows As Stream = Stream.Null
47 Try
48 sRows = File.Open(filename, FileMode.Open, FileAccess.Read)
49 Dim bfRows As New BinaryFormatter
50 Return CType(bfRows.Deserialize(sRows), Rows)
51 Finally
52 sRows.Close()
53 End Try
54
55 End Function ' Deserialize
56
57 End Class ' Rows
 After serializing the class I need to save it in an a SQL 2005 database.But all the examples I followed use the filename ... Anyway, do I need to do something to save this into an SQL 2005 database or can I use it as follows? And how can I use this?This is the first time I do something like this so I am a little bit confused.Thanks,Miguel    

View 1 Replies View Related

Using Pre-Built Serialization Assemblies

Apr 12, 2007

I have followed the steps outlined in the knowledge base article http://support.microsoft.com/kb/913668 for effecting Xml Serialization within the SQL CLR. That is, I have



1. Prebuilt the serialization assembly X.Serializers for the types in assembly X and,

2. Registered both assemblies with SQL Server via the create assembly directive



Yet, when I attempt to create an XmlSerializer on the basis of one of the types defined in X, SQL CLR ignores the pre-built serialization assembly and attempts to dynamically create/load the assembly. Since dynamic loading is disallowed, this fails with the expected exception:



System.InvalidOperationException: Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer. Please see inner exception for more information. ---> System.IO.FileLoadException: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.

System.IO.FileLoadException:

at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)

at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)

at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)

at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)

at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(Com

...

System.InvalidOperationException:

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, CompilerParameters parameters, Evidence evidence)

at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies)

at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)

at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)

at System.Web.Services.Protocols.SoapClientType..ctor(Type type)

at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()

at Cypress.Services.Client..





What do I need to do the force the runtime to load the pre-built serialization assembly instead of dynamically trying to create one?



Thank You,
Chris.

View 11 Replies View Related

Pre-Built Serialization Assemblies

Apr 12, 2007



I have followed the steps outlined in the knowledge base article http://support.microsoft.com/kb/913668 for effecting Xml Serialization within the SQL CLR. That is, I have



1. Prebuilt the serialization assembly X.Serializers for the types in assembly X via the SGEN tool and,

2. Registered both assemblies with SQL Server via the create assembly directive



Yet, when I attempt to create an XmlSerializer on the basis of one of the types defined in X, SQL CLR ignores the pre-built serialization assembly and attempts to dynamically create/load the assembly. Since dynamic loading is disallowed, this fails with the expected exception:



System.InvalidOperationException: Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer. Please see inner exception for more information. ---> System.IO.FileLoadException: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.

System.IO.FileLoadException:

at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)

at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)

at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)

at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)

at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(Com

...

System.InvalidOperationException:

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, CompilerParameters parameters, Evidence evidence)

at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies)

at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)

at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)

at System.Web.Services.Protocols.SoapClientType..ctor(Type type)

at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()

at Cypress.Services.Client..





What do I need to do the force the runtime to load the pre-built serialization assembly instead of dynamically trying to create one?



Thank You,
Chris.

View 1 Replies View Related

Encryption And Serialization Using CLR Stored Procedure

Mar 7, 2007

Jahnavi writes "I have some logic for Encryption and Decryption following the Serialization and Deserialization of an object.

I would like to move this approach to CLR stored procedures to leverage the advantages in SQL 2005.

Could you please provide me with the details of the pros and cons of the approach and the various possibilities over this.

Would be glad to receive any kind of inputs from you.

Thanks,
Jahnavi"

View 1 Replies View Related

Using Message Queue Task And Serialization

Mar 7, 2007

I have a C# application that get data (i.e. select Firstname, LastName from person) to form a DataSet object (i.e. PersonName variable inside my code). Then I want to post this DataSet object into a local private queue (the path is: .privatemyTestQ). Note that I carefully labled the message to be "Variables Message" (as needed per anothre thread discussion here in this forum).

I created a receiving package, in which I want to use SSIS's Message Queue task to retreive the above DataSet object (from C# application). I got failure:

[Message Queue Task] Error: An error occurred with the following error message: "Root element is missing.".

However, As a comparison research, I created another SSIS sending-package. And I used ADO.NET provider to get the same data to store the sull result set in a package-level variable. Then I use Message Queue task to post this variable (i.e. object) to the same private queue above. Then I run my above receiving package. I was successful to read back the messge that I posted from SSIS sending package. (Please note that if I use OLEDB provider for sending package to get data from database, the MSMQ task for sending failed due to serializtion issue for __ComObject. With ADO.NET provider, the result set is represented as a type of DataSet).



I then curiously looked into message body from Computer Management Counsol. I found that message sent from SSIS is in SOAP format while message from my C# application is NOT in SOAP (but only in XML format). Obviously SSIS MSMQ task serialize objects into SOAP format.



Can anyone here please help on how to serialize my DataSet object from my C# app) in compliance with the MSMQ task's spec so that I can read message from Q using SSIS package.



I use Visual Studio 2005 and MSMQ 3.0 version.

Your help is appreciated.

View 2 Replies View Related

SQL Server Native UDT Serialization Format

Jul 4, 2007

I have created a UDT Point from an MSDN example. Its declaration is the following:




Code Snippet [Serializable]
[Microsoft.SqlServer.Server.SqlUserDefinedType(Format.Native,
IsByteOrdered = true, ValidationMethodName = "ValidatePoint")]
public struct Point : INullable
{
private bool is_Null;
private Int32 _x;
private Int32 _y;
...


So it means that this class will be serialized in the native SQL Server format.
Is there any possibility to deserialize data retrieved from server as bytes to an object instance?
For example:



Code Snippet SqlDataReader rdr = cmd.ExecuteReader();

while (rdr.Read())
{
// Retrieve the raw bytes into a byte array
byte[] buffer = new byte[32];
long byteCount = rdr.GetBytes(1, 0, buffer, 0, 32);
Point pt = new Point();
// Here I need to fill the created object with retrieved data
}


After I retrieved the data in bytes format, I need to write it to the object. How can I do this? In fact, I have no possibility to use SqlDataReader in the following manner:



Code Snippet // Retrieve the value of the UDT
Point pnt = (Point)rdr[1];
// Point pnt = (Point)rdr.GetSqlValue(1);
// Point pnt = (Point)rdr.GetValue(1);



because I retrieve data in bytes not from the server, but from an unmanaged application.
I have a possibility to create an instance of the class, but how can I fill this instance with data? Is it possible to do using native SQL Server native format? How can I do this when UDT uses user defined serialization?

View 3 Replies View Related

ODBC Error 40001- Serialization Failure

Dec 21, 1999

I have started to see regular occurences of "ODBC error 40001- serialization failure" in the log of a client website (using cold fusion) and would be grateful for any suggestions on likely causes and solutions. The error message also mentions deadlock victims. Thank you in advance.

View 1 Replies View Related

Cannot Load Dynamically Generated Serialization Assembly

Feb 14, 2008

I am getting the following error when executing a CLR stored procedure. I have set generate serialization assembly to 'ON' with no effect. The error is:


System.InvalidOperationException: Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer. Please see inner exception for more information. ---> System.IO.FileLoadException: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.

System.IO.FileLoadException:

at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)

at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)

at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)

at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, St

...

System.InvalidOperationException:

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)

at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)

at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)

at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)

at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)

at System.Xml.Serialization.XmlSerializer..ctor(Type type)

at SoftBrands.FourthShift.Transaction.FSTIError..ctor(String XMLErrorString)

at SoftBrands.FourthShift.Transaction.FSTIClient.ProcessTransaction(String sTrxn)

at SoftBrands.FourthShift.Transaction.FSTIClient.ProcessId(...

My code is:


Partial Public Class StoredProcedures

<Microsoft.SqlServer.Server.SqlProcedure()> _

Public Shared Sub SpPICK00()

Dim DbCon As New SqlConnection("context connection=true")

Dim DbSql As New SqlCommand("SELECT TOP 1 * FROM TblTransactions", DbCon)

Dim TransactionID As Int64

DbSql.Connection.Open()

Dim DbRs As SqlDataReader

DbRs = DbSql.ExecuteReader

While DbRs.Read

TransactionID = DbRs("TransactionID")

End While

DbRs.Close()

Dim MenuID As Int16

Dim MONumber As String

Dim LineNumber As String

Dim PTUse As String

Dim SEQN As String

Dim WorkCentre As String

Dim Stock As String

Dim Bin As String

Dim Qty As Double



DbSql = New SqlCommand("SELECT * FROM VwPickList WHERE TransactionID = @TransactionID", DbCon)

DbSql.Parameters.Add("@TransactionID", SqlDbType.BigInt).Value = TransactionID

DbRs = DbSql.ExecuteReader

If DbRs.Read Then

MenuID = DbRs("MenuID")

MONumber = DbRs("MONumber")

LineNumber = DbRs("LineNumber")

PTUse = DbRs("PT_USE")

SEQN = DbRs("SEQN")

WorkCentre = DbRs("WorkCentre")

Stock = DbRs("Stock")

Bin = DbRs("Bin")

Qty = DbRs("Hours")

End If

DbRs.Close()

DbSql.Connection.Close()

DbCon.Dispose()

DbSql.Dispose()

Dim FSClient As New FSTIClient

FSClient.InitializeByConfigFile("\FPTESTFShiftMfgsysfs.cfg", False, False)

SqlContext.Pipe.Send("Config file initialized")

If FSClient.IsLogonRequired Then

FSClient.Logon("VBS", "visib", "")

End If

SqlContext.Pipe.Send("FSTI logged in")

If MenuID = 2 Then

Dim Pck As New PICK08

Pck.OrderType.Value = "M"

Pck.IssueType.Value = "I"

Pck.OrderNumber.Value = MONumber

Pck.LineNumber.Value = LineNumber

Pck.PointOfUseID.Value = PTUse

Pck.OperationSequenceNumber.Value = SEQN

Pck.ItemNumber.Value = WorkCentre

Pck.Stockroom.Value = Stock

Pck.Bin.Value = Bin

Pck.IssuedQuantity.Value = Qty

SqlContext.Pipe.Send("ready to process")

If FSClient.ProcessId(Pck) Then

SqlContext.Pipe.Send("process ok")

Else

SqlContext.Pipe.Send("process error: " & FSClient.TransactionError.Description)

End If

SqlContext.Pipe.Send("processed")

ElseIf MenuID = 1 Then

Dim Pck As New PICK04

Pck.OrderType.Value = "M"

Pck.IssueType.Value = "I"

Pck.OrderNumber.Value = MONumber

Pck.LineNumber.Value = LineNumber

Pck.PointOfUseID.Value = PTUse

Pck.OperationSequenceNumber.Value = SEQN

Pck.ItemNumber.Value = WorkCentre

Pck.IssuedQuantity.Value = Qty

SqlContext.Pipe.Send("ready to process")

If FSClient.ProcessId(Pck) Then

SqlContext.Pipe.Send("process ok")

Else

SqlContext.Pipe.Send("process error: " & FSClient.TransactionError.Description)

End If

SqlContext.Pipe.Send("processed")

End If

FSClient.Terminate()

End Sub

End Class

Any help anybody can provide on this would be fantastic.

View 2 Replies View Related

ODBC Error Code = 40001 (Serialization Failure)

Sep 22, 2004

We get this error constantly...

24.121.0.118, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322), ODBC Error Code = 40001 (Serialization failure) [Microsoft][ODBC SQL Server Driver][SQL Server]Transaction (Process ID 56) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.


Any ideas? Would setting the isolation level to Read Commited help?

View 1 Replies View Related

Cannot Load Dynamically Generated Serialization Assembly SQLCLR

Apr 10, 2008



In article http://support.microsoft.com/kb/913668 it says to generate a serialization assembly and pop this into the database along side the assembly with the serialized type. All well and good, but how doe the XmlSerializer know to look in the database for the assembly - does it use the name of the assembly + XmlSerializer?

It is certainly ambiguous in the aforementioned kb article. In one place it generates an assembly in the database called

CREATE ASSEMBLY [MyTest.XmlSerializers] from
'C:CLRTestMyTestMyTestinDebugMyTest.XmlSerializers.dll'
WITH permission_set = SAFE

and in another it uses

USE dbTest
GO
CREATE ASSEMBLY [MyTest] from 'C:CLRTestMyTest.dll'
GO
CREATE ASSEMBLY [MyTest.XmlSerializers.dll] from 'C:CLRTestMyTest.XmlSerializers.dll'
GO

I can't get either to work, and I've tried various combinations, this and the fact that the kb artice uses two different naming conventions suggests to me that there must be "something else" which links the assembly with the serialization assembly.

Any ideas?

Thanks,

Dan

View 18 Replies View Related

SQL2005 Cannot Backup A Restored SQL2000 Database With Unknow Database Full-text Catalog Database

Nov 15, 2007



We replicate a SQL2000 database (DataBaseA) to a SQL2000 database (DataBaseB) by using the Restore function and hasn't change its logical name but only the physical data path and file name. It is running fine for a year. We use the same way to migrate the DataBaseB to a new SQL2005 server with the Restore function and the daily operation is running perfect. However, when we do the Backup of DatabaseB in the SQL2005, it just prompt the error message


System.Data.SqlClient.SqlError: The backup of full-text catalog 'DataBaseA' is not permitted because it is not online. Check errorlog file for the reason that full-text catalog became offline and bring it online. Or BACKUP can be performed by using the FILEGROUP or FILE clauses to restrict the selection to include only online data. (Microsoft.SqlServer.Smo)


Please note we left the DataBaseA in the old SQL2000 server.


Please help on how we can delete the Full-text catalog from DatabaseB so we can do a backup


Many Thanks

View 1 Replies View Related

Replication :: Syncing Of Database From Local Host Database To Online Database Automatically After Some Interval

Oct 14, 2015

I have database on localhost and i want to show this data on my website. I want to create a database online and want to sync with Local Host. Can it be possible syncing data automatically after some interval?

View 6 Replies View Related

The Database File May Be Corrupted. Run The Repair Utility To Check The Database File. [ Database Name = SDMMC Storage Cardwinp

Oct 9, 2007

yes,I have an error, like 'The database file may be corrupted. Run the repair utility to check the database file. [ Database name = SDMMC Storage Cardwinpos_2005WINPOS2005.sdf ]' .I develope a program for Pocket Pcs and this program's database sometimes corrupt.what can i do?please help me

View 4 Replies View Related

Coping Database Objects From One Database To Another Blank Database.

Aug 18, 2005

I want to create a duplicate database   in sql 2000 using asp.net from a webform
I created a database using CREATE DATABASE .......

But how to copy tables, views, stored procedures to newly created
database from old using asp.net from webform

Is there any another method to create a duplicate database with another name
from existing database on same server ?

View 5 Replies View Related

An Attempt To Attach An Auto-named Database For File (file Location).../Database.mdf Failed. A Database With The Same Name Exists, Or Specified File Cannot Be Opened, Or It Is Located On UNC Share.

Sep 2, 2007

Greetings, I have just arrived back into the country (NZ) and back into ASP.NET.
 I am having trouble with the following:An attempt to attach an auto-named database for file (file location).../Database.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
It has only begun since i decided i wanted to use IIS, I realise VWD comes with its own localhost, but since it is only temporary, i wanted a permanent shortcut on my desktop to link to my intranet page.
 Anyone have any ideas why i am getting the above error? have searched many places on the internet and not getting any closer.
Cheers ~ J
 

View 3 Replies View Related

The Backup Set Holds A Backup Of A Database Other Than Existing Database. Restore Database Is Terminating Abnormally

Apr 9, 2008



I have a problem when i restore my .DAT_BAK file. I am getting error like "The backup set holds a backup of a database other than existing database. Restore Database is terminating abnormally".

I tried by using

RESTORE DATABASE <DATABASENAME>
FROM DISK = 'D:DATAMYTEST.DAT_BAK'
WITH MOVE 'VZAI_DATA' TO D:PROGRAM FILES..MSSQLTEST.MDF',
MOVE 'VZAI_LOG' TO D:PROGRAM FILES..MSSQLTEST.LDF',
REPLACE

And also i tried like


RESTORE DATABASE <DATABASENAME>
FROM DISK = 'D:DATAMYTEST.DAT_BAK'

WITH REPLACE

When i use like this,

RESTORE FILELISTONLY FROM DISK = 'D:DATAMYTEST.DAT_BAK'. I am able to get the output as LogicalName, PhysicalName, Type, FileGroupName, Size, etc.

Can i anyone please help me out?

Thanks in Advance,
Anand Rajagopal

View 8 Replies View Related

Cant Create New Database / CREATE DATABASE Permission Denied In Database Master (error 262)

Oct 2, 2007

 
 I am using SQL express and Visual web developer on windows Vista.
When I try to create a new database the following message appears.
 
CREATE DATABASE permission denied in database master (error 262)
I log on to my computer as an administrator.
Help appreciated
 Prontonet
 
 
 

View 4 Replies View Related

NORTHWIND Database Was Re-created From A Different Database:How Can I Change The Entry In Sysdatabases For Database 'NORTHWIND'?

Jan 14, 2008

Hi all,

From the http://msdn.microsoft.com/en-us/library/bb384469.aspx (Walkthrough: Creating Stored Procedures for the Northwind Customers Table, I copied the following sql code:

--UpdateSPforNWcustomersTable.sql--

USE NORTHWIND

GO

IF EXISTS (SELECT * FROM sysobjects WHERE name = 'SelectCustomers' AND user_name(uid) = 'dbo')

DROP PROCEDURE dbo.[SelectCustomers]

GO

CREATE PROCEDURE dbo.[SelectCustomers]

AS

SET NOCOUNT ON;

SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM dbo.Customers

GO

IF EXISTS (SELECT * FROM sysobjects WHERE name = 'InsertCustomers' AND user_name(uid) = 'dbo')

DROP PROCEDURE dbo.InsertCustomers

GO

CREATE PROCEDURE dbo.InsertCustomers

(

@CustomerID nchar(5),

@CompanyName nvarchar(40),

@ContactName nvarchar(30),

@ContactTitle nvarchar(30),

@Address nvarchar(60),

@City nvarchar(15),

@Region nvarchar(15),

@PostalCode nvarchar(10),

@Country nvarchar(15),

@Phone nvarchar(24),

@Fax nvarchar(24)

)

AS

SET NOCOUNT OFF;

INSERT INTO [dbo].[Customers] ([CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax]) VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax);

SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE (CustomerID = @CustomerID)

GO

IF EXISTS (SELECT * FROM sysobjects WHERE name = 'UpdateCustomers' AND user_name(uid) = 'dbo')

DROP PROCEDURE dbo.UpdateCustomers

GO

CREATE PROCEDURE dbo.UpdateCustomers

(

@CustomerID nchar(5),

@CompanyName nvarchar(40),

@ContactName nvarchar(30),

@ContactTitle nvarchar(30),

@Address nvarchar(60),

@City nvarchar(15),

@Region nvarchar(15),

@PostalCode nvarchar(10),

@Country nvarchar(15),

@Phone nvarchar(24),

@Fax nvarchar(24),

@Original_CustomerID nchar(5)

)

AS

SET NOCOUNT OFF;

UPDATE [dbo].[Customers] SET [CustomerID] = @CustomerID, [CompanyName] = @CompanyName, [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, [Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode, [Country] = @Country, [Phone] = @Phone, [Fax] = @Fax WHERE (([CustomerID] = @Original_CustomerID));

SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE (CustomerID = @CustomerID)

GO

====================================================================================
I executed the above code in my SQL Server Management Studio Express (SSMSE) and I got the following error messages:

Msg 911, Level 16, State 1, Line 1

Could not locate entry in sysdatabases for database 'NORTHWIND'. No entry found with that name.

Make sure that the name is entered correctly.

===============================================================================================================
I know I recreated the NORTHWIND Database from a different Database before and I did not do anything for the entry in sysdatabases. How can I change the entry in sysdatabases for database 'NORTHWIND' now? Please help and advise.

Thanks in advance,
Scott Chang

View 5 Replies View Related

Copy Database One Database To Onther Database

Mar 27, 2007

hii want to copy one database table to onther database table using script?my database is ms-sql server 2000 

View 4 Replies View Related

SQL Server 2005 Express: The Database Principal Owns A Schema In The Database, And Can Not Be Dropped.

Jan 11, 2006

I recently added a new user to my database.  Now I want to delete that user, but I keep getting the error above.  What do I need to do to delete my recently added user?

View 4 Replies View Related

Database Create ODBC Connections To Access Database Directly And Update Data?

Sep 10, 2012

We have a SQL database that uses Active Directory with Windows Authentication. Can users that are members of the Active Directory group that has read/write access to the SQL database create ODBC connections to access the database directly and update the data? They dont have individual logins on the server. They are only members of the Active Directory group that has a login?

View 1 Replies View Related

SQL Server 2008 :: How To Update The Database Physical File Location In Master Database

Mar 8, 2015

I had to to relocate the database log file and I issued an Alter database command but by mistake I put a space in the file name as below. The space is at the beginning file name. Now I am unable get the database loaded to SQL Server. The database has 2 replications configured, so deleting and re-attaching the database means the replication needs to be re-configured. Is there an alternative way to issue a command to update the database FILENAME ? Not sure if this can be edited in master database (sys files).

ALTER DATABASE [User_DB]
MODIFY FILE (NAME = User_DB_log, FILENAME = 'I:SQLLogs User_DB_log.ldf')
GO

View 1 Replies View Related

I Have A Database On A Network Drive That I Use For Archiving Purposes, But When The Server Is Rebooted The Database Becomes Suspect.

Mar 31, 2007

I created the db with the attached script and I am able to access ituntil I reboot the server. I've tried enabling flag 1807 via the SQLserver service and the startup parameters of the instance. In allcases the database always come up suspect after a reboot. There wasone instance where I was able to recover, but I am not sure how thathappened.Does anyone have an idea of how I can reboot the server without thedatabase becomming suspect?USE MASTERGODBCC TRACEON(1807)GO--DBCC TRACEOFF(1807)--DBCC TRACESTATUS(1807)GOCREATE DATABASE ReadyNAS ON( NAME = ReadyNAS_Data,FILENAME = '\NAS1NASDiskSQL ServerReadyNASReadyNAS_Data.mdf',SIZE = 100MB,MAXSIZE = 20GB,FILEGROWTH = 20MB)LOG ON ( NAME = ReadyNAS_Log,FILENAME = '\NAS1NASDiskSQL ServerReadyNASReadyNAS_Log.ldf',SIZE = 20MB,MAXSIZE = 100MB,FILEGROWTH = 10MB)

View 5 Replies View Related

Database Explorer In VB Express:AdventureWorks.mdf-Files Do Not Match The Primary File Of The Database

Nov 5, 2007

Hi all,

I downloaded and ran AdventureWorks.msi into my SQL Server Management Studio Express (SSMSE) one year ago.But I did not know how to attach it to my SSMSE then. Last week, I deleted it from the "Add or Remove" of Control Panel and I downloaded the new AdventureWork.msi and installed it my SSMSE. Today, I tried to use the Database Explorer of VB 2005 Express for the first Stored Procedure programming. I clicked on AdventureWorks.mdf and I got the following error: One or more files do not match the primary of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupt and should be restored from a backup. Cannot open user default database. Login failed. Login failed for user 'CENADe1enxshc'. Log file 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataAdventureWorks_Data_log.ldf' does not match the primary file. It may be from a different database of the log may have been rebuilt previously. Please help and advise me how to correct this problem.

Thanks,
Scott Chang

View 9 Replies View Related

2005 Database Will Be Shown In Management Sudio Express Or App_Data/Database Explorer?

Feb 13, 2008

I have installed 2 SQL Server 2005 Express sample databases from 2 books, ASPnet 2.0 and ADOnet 2.0. The ASPNETDB.MDF was shown in App_Data and Database Explorer, but not in the SQL Server Management Studio Express. The AdoStepBy Step database created by a ConfigDB.exe was displayed in the Management Studio, but not in the App_Data, or Database Explorer.

Is this the way SQL Server 2005 runs the 2005 databases for SQL Server 2005 Express only? Or also in SQL Server 2005?

TIA,
Jeffrey

View 6 Replies View Related

SQL Security :: How To Create Database Specifications On Newly Created Database Automatically For Audit

Jul 15, 2015

I am setting up SQL audit on sql servers in my environment based on requirement. I want to create database specifications ASAP database created. I tried DDL trigger but Audit doesn't support triggers. So I created audit specifications on model database. the only problem with this is every specification created on new database with same name.database specification name includes newly created database name or other methods to create database specifications on newly created databases.

View 6 Replies View Related

Integration Services :: Import Varying Number Of Tables Each Time From One Database To Different Database

Sep 9, 2015

I am new to SSIS. I have been struggling with this for the past one week. I have a weird task. I need to import several tables from one database to a different server with a new database name. We need to do this at the end of every year. The main problem here is that the number of tables varies every year. You may not have all the tables as last year or may have more tables. So I need to create a dynamic task that takes care of this every year without changing the package.

I have performed the following tasks **

1. Create a new dynamic database. ( I have used Execute SQL Task to do this) 2. Copy all the table structures ( I have used Execute SQL Task to do this)

3. Import Data. This is the main problem. I was trying to create a dynamic connection string with variables as suggested in several forums but I finally came to know that this cannot be done if the table structures are different as the metadata cannot be refreshed at runtime.

4. The final step to create a process to validate the data (the count from each table for both source and destination. I think this can be done with Sql task.

What is the best method to do this? My DBA does not like “Transfer SQL Objects Task” or “transfer Database Task”. I would like to create this as a dynamic process.

View 5 Replies View Related

Migrating From Sql2000 MSDE Database To Sql2005 Express - Attach Database Errors

Apr 23, 2006

I have a medical records system, SoapWare v4.90, that uses MSDE (SQL2000) databases. Due to the 2gb limitation, I am trying to migrate over to SQL 2005 (Standard or Express) which I have heard works fine. The SoapWare has a datamanager that allows me to log in to the MSDE instance, detach the SoapWare databases from msde (as well as do backups, etc) which I can confirm are detached.

Then I log back into a SQL2005 database instance using the datamanager and try to attach the database. This is what their pictured instructions demonstrate. However, I get the following error:


Database 'sw_charts' cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.


Of course, some of the entries will be read only, since doctors have to sign off the charts and are not allowed to subsequently change them.  But I should still be able to switch over to sql 2005?!?!?!?


Or... is there a way to attach the databases to SQLExpress manually?

Help pls?

View 1 Replies View Related

The Log File For Database 'Home_alone' Is Full. Back Up The Transaction Log For The Database To Free Up Some Log Space.

Feb 4, 2008



Hi all

Iam working in Prodcution ENV,Please help how make space


The log file for database 'Home_alone' is full. Back up the transaction log for the database to free up some log space.

View 10 Replies View Related

Question: Can I Synchronize The Mobile Device Which Has A SQL Server CE Database With The Access Database On The Desktop?

Sep 26, 2006

Dear All,
i have a question abt winCE 4.2 and SQL server CE.
i am using VB.net of Visual Studio 2005
My platform is using a PDA with winCE 4.2 and SQL server CE. The Host program is using dbf files on desktop side.


I got a problem of how to sync / read the sql CE data from a windows application.

so, i wanna ask,

1. any method to access the data from winCE data by windows application? or can i convert the sdf file to windows readable files? or any others?

2. Can i use a MDB to sync with SQL server CE?
can i synchronize the mobile device which has a SQL Server CE database with the Access database on the desktop?

last question,
3. is that windows CE .net 4.2 not support pocket access (cdb) anymore?

please help me out

View 1 Replies View Related

SQL Attached Mdf Database Files VS Database Imported Into Or Created In SQL Server 2005

Apr 8, 2007

 Hi all (newbie @ asp.net)(oldie @ ASP 3)What is the purpose of using an attached MDF database files in the App_Data folder on a web site as to importing it into the SQL server directly or creating it on the SQL server. Does a mdf database attached file purely use the SQL server as a connection interface.Is it something similiar to DSN(ODBC) Connections for ms access databases.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved