I was just restoring one database and creating another concurrently on the same server. The restore took longer than the create due to the respective sizes.
After the create had finished (done in Query Analyzer) I went back to the restore to see how it was getting on (running in Enterprise Manager).
There was an error (which I didn't record exactly - DOH!) along the lines of "could not obtain a lock on the model database, restore terminating abnormally."
I guess the create had model locked while it was creating the default objects, but what was a *restore* doing needing the model database anyway?
I'm trying to copy a database from my web host to local Sql Server 2005 instance using the Copy Database wizard. I get this error:An exception occurred while executing a Transact-SQL statement or batch. Server user 'celestine' is not a valid user id database 'db2'.However, 'db2' isn't the database I was trying to copy! I am trying to copy db1, but this error is complaining about db2, which is in fact somebody else's database that I don't have a login for. Why am I getting an error about db2 when I'm not trying to do anything with db2???I can however export the tables from db1 just fine using Export. But then I have to go back and generate script to re-create the stored procs, views, etc., so it is rather tedious to do it that way.
Hello, I'm tyring a simple piece of code to conenct to my database: SqlConnection con = new SqlConnection("Data Source=localhost; Initial Catalog=OrderingSystem; Integrated Security=SSPI"); try { // Try to open the connection. con.Open(); label1.Text = "<b>Server Version:</b> " + con.ServerVersion; label1.Text += "<br /><b>Connection Is:</b> " + con.State.ToString(); } catch (Exception err) { // Handle an error by displaying the information. label1.Text = "Error reading the database. " + err.Message; } finally { // Either way, make sure the connection is properly closed. // Even if the connection wasn't opened successfully, // calling Close() won't cause an error. con.Close(); label1.Text += "<br /><b>Now Connection Is:</b> " + con.State.ToString(); } When I try this, I get an error:"Error reading the database. Cannot open database "OrderingSystem" requested by the login. The login failed. Login failed for user 'NT AUTHORITYNETWORK SERVICE'." The strange thing is, this code works perfectly If I use it in a Windows Forms application. Is it a problem with SQL server, IIS or my code?I'm using SQL Server 2005 (SP2) 32bit developer edition + IIS 6.0 + Visual Studio 2008 Pro all runnign on my Windows XP x64 PC. Thankyou
Hello, I am taking the error message which is in the below side,while restoring a database.(I am using sql server 2005) The backup set holds a backup of a database other than the existing 'db1' database. (db1 is the database name.) Can you help me?
Hi, I have one backup file of one database, I want to restore the database to server using that backup file. But when I tried to restore the database using that backup file, the query executed successfully, but in management studio at the database it is showing the message like 'Restoring the database'. The database i am trying to restore is about 2.71gb memory. I executed the query 4hrs back but still it is showing same message that it is getting restored. Why it is showing like this. Please help me to solve this problem. The query i used to restore the database is - 'RESTORE DATABASE [Everydayonline] FROM DISK = N'D:BOOKSEverydayBackUp' WITH NORECOVERY, NOUNLOAD, STATS = 10, MOVE 'ASPNETDB_983ed943e1fe49e3ae7fa189b823b238_DAT' TO 'D:SQLEverydayOnline.mdf', MOVE 'ASPNETDB_TMP_log' TO 'D:SQLEverydayOnline_log.ldf' GO'
I did the full backup of .7 TB database about 2 weeks ago and did full restore with norecovery mode and then i did differential backup of about 100 gb and tried to restore but it is showing following error : System.Data.SqlClient.SqlError: This differential backup cannot be restored because the database has not been restored to the correct earlier state. (Microsoft.SqlServer.Smo)
While restoring the files are different than original database files
I have a phisical device called 'respaldo.bak' inside this file there are three backups of three different databases, The first one is database called 'innovasoft' the second one is 'modelo_de_datos' and the last one is 'Inversiones'.
If I perform a restore of the first one there is no problem, but, when i try to restore the second o third database i get the following error:
TITLE: Microsoft SQL Server Management Studio ------------------------------ Restore failed for Server 'COMPUTO'. (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476 ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ El archivo lógico 'INNOVASOFT_Datos' no es parte de la base de datos 'PROBANDO'. Use RESTORE FILELISTONLY para enumerar los nombres de los archivos lógicos. Fin anómalo de RESTORE DATABASE. (Microsoft SQL Server, Error: 3234) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=3234&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
I have to say that i want to restore the database with a different name that's why in the error says 'PROBANDO' , i'm really concern about this problem because it means that i have no backups for my data. I used to use this procedure on sql server 2000 every single day without problems, but on sql server 2005 it doesn't work properly.
When attempting to restore a database, I get the following error:
'Cannot open backup device, (filename).bak, Operating system error 5, access is denied.'
I get similar errors when attempting to attach the database file, it shows up in the Mngt. Tool as 'read only'.
This error does not occur when restoring the same .bak file to other pc's. On the problem pc, we have completely uninstalled and reinstalled Sql Express and Mngt. Tool Express. It occurs whether logged in as full administrator or other user.
I met a very strange problem recently. I set up a database integrity check maintenance plan. But this job failed every time. I looked into the logs, the error message was that Databases that have a compatibility level of 70 (SQL Server version 7.0) will be skipped. I used the sp_helpdb to check the version of the databases included in my maintenance plan. The sp result shows that all the databases are above version 80....
Even more strange, i can successfully run the dbcc check query on each database.
Any comment and suggestion will be very appreciated.
I m a student and i m doing a project on Datamining. I have to mine data of a company. the issue is that the company uses Microsoft SQL server as there DBMS. they backed up there data and gave it to me with schema (schema is separate and data backup is a backup generated through the backup option in SQL server Enterprise Manager). Now i created tables through query analyzer (i think) and then through enterprise manager i tried to restore that backup on my personal pc and i get an error . the image is attached see the image for the error http://img.photobucket.com/albums/v54/kaboomagic/error.jpg
Hi experts! I am using SQL Server 2005. while restoring a database. I got following error:
" An exception occured while executing a Transct-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) Additional Information: Too many backup devices specified for backup or restore; only 64 are allowed. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error:3205 ) "
Hi,We have 2 servers. Server1 is a 2000 box, with SP3 (yes I know it isnot up to date). Server2 is a 2005 box, SP2.I set up Server1 (2000) to have a linked server to Server2 (2005). Thereason I did this is because we are using a stored procedure onServer2 to send mail, as we have found that using mail on 2000 doesn'talways work as advertised.When I set up the linked server on the 2000 box, for security I justset it up to use a SQL Server user on the 2005 box. The SQL Serveruser on the 2005 box has permissions to run the stored procedure forsending mail.Here's the weird thing though. When calling the stored procedure onthe 2005 box from the 2000 box, sometimes we get an error that "Thedefault database cannot be opened", and the query does not run on the2005 box. However, it only happens *sometimes*. Other times, the queryruns fine.Since the problem seeemed to be with the default database, I changedthe SQL Server user on 2005 default database to the SAME database thatcontains the stored procedure.However, I just don't understand why it's even TRYING to open thedefault database, since when we called the linked server we are doingso as, and it's referencing the default database in the name:EXEC Server2.DefaultDatabase.dbo.StoredProcedureNameHowever, after changing the user's default database to"DefaultDatabase" as shown above, the query runs fine.Why are we having this problem? That is, if I change the defaultdatabase to something other than "DefaultDatabase", then the querydoesn't run, even though the database name is referenced in the abovequery??Obviously, this is not desireable, because that means we can only runqueries that are in "DefaultDatabase", which may not always be thecase.Thanks much
I backup a database at the begining of each month with a full and then do nightly diffs on it.
For the same database I run daily fulls and 10 minute log backups.
these two backups create / append to two different backup files.
The problem im having is that I cant restore the Differential backup set. SQL seems to restore the full just fine but alwasy throws an error when its about to start to retore the last diff. now forgive me but I clicked OK on the message and I cant find any record of the error in the logs but its something like:
"SQL cannot restore the database as the database has not been restored to the previous correct state"
is my 10 min TS log backups screwing up the DIff chain somehow?
this is really doing my head in. any help appreciated.
"A computer once beat me at chess - but it was no match for me at kick boxing" - Emo Phillips.
I did a full backup of a db from one server(Express2005) and trying to restore it to a different instance of SQL2005 on the same development machine. (Also had some fulltext columns if that means anything)
Many failures but finally got it to report all was successful except the icon in Object Explorer shows (Restoring...) with no indication of any real activity going on. It's a tiny database with hardly any data in it.
Just not sure what the heck is going on there. It also won't let me into the database until this the (Restoring...) goes away.
I am using c# and ASP.NET 2 and I am getting a very strange error. I have a field called CompanyID in SQL Server 2005, and it allows null values in it. When this CompanyID is not NULL, ie for example it is 202, then when i press the update button it allows me to update perfectly in the database. However if the CompanyID is NULL, and I try to update the companyID, to lets say 202, the application just crashes with the following message:- System.InvalidCastException: Object cannot be cast from DBNull to other types. I tried to set some breakpoints in the application to debug, however it does not even pass through these breakpoints! Any ideas on what the problem can be or how I can debug? Thanks for your help and time Johann
So we currently are running a SQL 7 Server, which hopefully we will be updating this year but untill then we're stuck. I've got a web app using ASP.NET 2.0 and on occasion I get this error: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - Only one usage of each socket address (protocol/network address/port) is normally permitted.) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open()
I Some sql that it keeps throwing the following error
SqlDumpExceptionHandler: Process 52 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
Here is the sql
UPDATE dbo.temptable SET code = 'MM' FROM dbo.temptable T JOIN dbo.Item I WITH (NOLOCK) ON T.ProductID = P.ProductID JOIN dbo.cars C WITH (NOLOCK) ON I.ModelID = C.ModelID JOIN dbo.carmakes CM WITH (NOLOCK) ON CM.MakeID = C.MakeID JOIN dbo.CarDealerMakes CDM WITH (NOLOCK) ON CM.MakeID = CDM.MakeID WHERE T.ProductID NOT IN (
SELECT distinct A.ProductID FROM dbo.Action A WITH (NOLOCK) JOIN dbo.ActionPurchases AP WITH (NOLOCK) ON A.ActionID = AP.ActionID WHERE A.CustomerID = 2
UNION
SELECT distinct A.ProductID FROM dbo.Action A WITH (NOLOCK) JOIN dbo.ActionServices S WITH (NOLOCK) ON A.ActionID = S.ActionID WHERE 2 = A.ProductID)
That sql will run on windows 2000 but it will not run on windows 2003. I have the latest service pack.
Has anyone ever come across this before or have and suggestions ?
Hello I have one PC with SQL server 2000 and I am working on one database called TaxReg but today I found it gray and (suspect) beside it could you please tell what is the problem and how to fix it ?
SELECT TOP 9 id,vehicleref,capid,manufacturer,model,derivative,ch,'3' as term,'10000' as mileage,'orderby' as orderby,cvehicle_shortmodtext,source,studioimages FROM vwAllMatrixWithLombardAndShortModel WHERE locatcode =1 GROUP BY id,vehicleref,capid,manufacturer,model,derivative,ch,term,mileage,orderby,cvehicle_shortmodtext,source,studioimages
Msg 207, Level 16, State 1, Line 2 Invalid column name 'mileage'. Msg 207, Level 16, State 1, Line 2 Invalid column name 'orderby'.
In my package I am executing 8 'Execute package' tasks which calls 8 different packages. All these tasks are indepent so they are not connected to each other. In each package I have defined a variable at the start of each package there is a script task to assign the 'StartTime' system variable value to the user defined variable.
If I run the tasks individually, it is running without any problem. When I am running all the tasks in the parent package, very often the package fails and each time different different tasks are failing. But the error happens at the script task which is used to define the start time. The error message is 'Error: The script threw an exception: Object reference not set to an instance of an object.'. But inside the script task, I have only one statement which assigns the system start time value to the user variable. Also, in my log file, I am getting 2 entries for all the tasks in that failing child package, but I have not specified any looping in my parent package. One more peculiar thing is even though as per the log entry it ran twice, no single record is inserted/updated(????).
I am getting the following error when I try to debug a package that needs to Copy Columns from an AS400 database into SQL 2005:
[SQL Server Destination [1684]] Error: An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E14 Description: "Could not bulk load because SSIS file mapping object 'GlobalDTSQLIMPORT ' could not be opened. Operating system error code 2(The system cannot find the file specified.). Make sure you are accessing a local server via Windows security.".
Has anybody seen this error and what do I need to do and check for?
I am getting this error on an almost daily basis. Using SQL 2005 fully patched.
I searched the web and couldn't fin anthing about it. has anyone here seen this problem before...
Disk space is fine btw... 35GB free
Message An error occurred while writing an audit trace. SQL Server is shutting down. Check and correct error conditions such as insufficient disk space, and then restart SQL Server. If the problem persists, disable auditing by starting the server at the command prompt with the "-f" switch, and using SP_CONFIGURE.
I did tried the encryption on server "A" for database "AdventureWorks2012". Then I tried to restore to server "B". There was the certificate issue, and I thought "of course : it's encrypted ! Let's deactivate it". So here I go "ALTER DATABASE AdventureWorks2012 SET ENCYRPTION OFF".I look at sys.databases : not encrypted.I backup using no encryption, I verify using msdb.dbo.backupset : not encrypted.
I move my backup to my other server where encryption was never configured (so no certificate, nothing...), and I have the error : Msg 33111, Level 16, State 3, Line 1
Cannot find server certificate with thumbprint '0xFA130E58C999C4919B8975999C83A75A403B11D8'. Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally.
I want to restore a database (from an encrypted .bak file) - but *not* over the live original if you take my meaning. Encryption is the standard AES-256 that comes with Sql Server 2014 btw. I don't want the original touched/altered in any way. I would like to capture a success message if possible.I can extract the physical device name of the database in question using the following code:
SELECT physical_device_name, * FROM msdb.dbo.backupmediafamily WHERE media_set_id =(SELECT TOP 1 media_set_id FROM msdb.dbo.backupset WHERE database_name='MyDatabase' AND type='D' ORDER BY backup_start_date DESC)
I would like if the newly restored database was rename to something different than 'MyDatabase' (as shown above) and has different logs than the original. If possible, and capture a success message when restored.
I have a table called subscribers with the following fields CustID (identity)email (text) fname (text)lname (text) - may be emptysubDate (smalldate)Confirmed (boolean) - initially will be emptyConDate (smalldate) - initially will be empty I have a strongly typed dataset that contains only the one table. It has the method GetDataByIsSubscribed SELECT emailFROM SubscribersWHERE (email = @email) And I have a function which calls it Public Function ValSubscribe(ByVal vEmailAddr As String, ByVal vFName As String, ByVal vLName As String) As String Dim SubscriptionAdapter As New EmailSubscriptionsTableAdapters.SubscribersTableAdapter Dim dF As Data.DataTable = SubscriptionAdapter.GetDataByIsSubscribed(vEmailAddr) If dF.Rows.Count > 0 Then ValSubscribe = "This email address is already subscribed!" Else SubscriptionAdapter.InsertSubscriber(vEmailAddr, vFName, vLName, Now) ValSubscribe = "success" End IfEnd Function This is an existing table that contains duplicate email addresses, but I don't want to add any more dups. You can see I have another method to add records, which works fine, though I've only tried to add email addresses that I know aren't in the table. If I run the above code which first checks to see if an email address is in the table, and I use an email address that is, I get the following error System.Data.ConstraintException was unhandled by user code Message="Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." Source="System.Data" StackTrace: at System.Data.DataTable.EnableConstraints() at System.Data.DataTable.set_EnforceConstraints(Boolean value) at System.Data.DataTable.EndLoadData() at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at EmailSubscriptionsTableAdapters.SubscribersTableAdapter.GetDataByIsSubscribed(String email) in C:WINNTMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Fileswap48b4654224232ecApp_Code.ihd33v1_.4.vb:line 872 at Validate.ValSubscribe(String vEmailAddr, String vFName, String vLName) in C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesWAPApp_CodeValidate.vb:line 90 at Validate.vCheckPage(String vEmailAddr, Int32 vLevel, String vFName, String vLName) in C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesWAPApp_CodeValidate.vb:line 28 at advertise.Page_Load(Object sender, EventArgs e) in C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesWAPform-advertise.aspx.vb:line 32 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) I think I understand what this error is telling my, but I don't get why. All the fields except CustID allow nulls. There are no foreign-keys, and I don't see where any fild by custID requires unique entries. If I run the query in the designer, I don't have a problem. What am I missing? Diane
i m using sql server 2000. My problem is tht no matter what date i enter, sql server always displays it as 1900-1-1. This is happening on all columns which have been specified as datetime. Whts the problem & the solution to the problem?
I have a function that retrieves a data set from a passed SQL string. I'm getting this weird error.
Input string was not in a correct format
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 205: sSQL = "Select * From LedgerDetails Where LedgerID = " & _LedgerID.ToString() Line 206: msgbox(sSQL) Line 207: TransactionDetails = GetDataSet(sSQL) Line 208: Line 209: _TransactionsIndex = CShort(Val(GetDataValue("Select Count() From LedgerDetails Where LedgerID = " & CStr(_LedgerID)))) -1
Source File: C:Documents and SettingsOwnerMy DocumentsUniversityFall 2004DSSASP WorkAlgorithmTest.aspx Line: 207
Stack Trace:
[FormatException: Input string was not in a correct format.] Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) +184 Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +96
[InvalidCastException: Cast from string "Select * From LedgerDetails Wher" to type 'Integer' is not valid.] Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +211
I have no idea why, but it seems to trying to convert the string into an integer. Both the argument and the parameter in the function are strings. I checked on the internet and the usual response is this is because the SQL is incomplete, but I have it showing me the compiled SQL string, and it is not imcomplete. I've tried hotwiring the query to match something I know will work, and I still get the same error. I've also tried compile the string using .ToString() on my number portion, storing the converted number into a string and only combining strings on the call, using another string variable as a temporary holder, using the String.Concat function, and even CStr. There is no way possible that this thing is an integer when the call is sent...
I've been building a simple test application and things have been working all day. Suddenly, about a half an hour ago - I started getting this error every time I attempt to go to the main web page: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) I have no idea what changed... Can someone help me figure this out please? Thanks!~A~
I have two SQL servers onr is staging (SQL2005) the other is production (SQL2000). I have a primary key with constraints on a table and I script out the Create for the primary key with constraints. I run the generated T-SQL script on the staging (SQL2005) and it works great. No probs so far. Now I cut and paste the same generate T-SQL script into my production (SQL2000) server and I get this error...
Msg 170, Level 15, State 1, Line 2 Line 2: Incorrect syntax near '('.
Now this is the same exact cut/paste of the script that ran perfectly fine on my SQL2005 server. So I copied it agan from production (SQL2000) and pasted it into staging (SQL2005) and it works.
Here's the script... USE [TEST] GO ALTER TABLE [dbo].[fovecComments] ADD CONSTRAINT [PK_fovecContacts] PRIMARY KEY CLUSTERED ([iUserId] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO
I keep getting this conversion error when I run this query: If I comment from the second part of the where clause it goes away? I can't figure out how to fix this!
Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value 'B' to data type int.
Select sE.SSN, sE.enroll_yyyyQ_Code, sE.Sched_Switch, sE.gdb_Switch, sE.Fee_Switch, sE.Rank_Code, sE.Class_Code, sE.Status_Code, sE.Prim_Coll_Code, sE.Secondary_Coll_Code, sE.Dept_Major_Code, sR.Client_ID, sR.Contact_Number, master.dbo.fn_InitCap(nM.last_name) Last_Name, master.dbo.fn_InitCap(nM.first_name) First_Name, master.dbo.fn_InitCap(nM.mid_name) Middle_Name, nM.sfx_name, eA.Published_eMail_Address /* Tables ................................................................ */ From FCoBDB.Student_Current.dbo.enrollment sE With ( noLock ) JOIN FCOBDB.Student_Current.dbo.Name nM With ( noLock ) ON sE.SSN = nM.SSN LEFT OUTER JOIN FCoBDB.Student_Current.dbo.eMail_Address eA With ( noLock ) ON sE.SSN = eA.SSN LEFT OUTER JOIN ADIS_Import_Support.dbo.Student_Records sR With ( noLock ) ON sE.SSN = sR.SSN /* Selection Clauses ...................................................... */ Where /* Undergraduate Business Students .................................. */ ( sE.prim_coll_code = 'BUS' and sE.dept_major_code <> '805' and sE.status_code = 1 and /* Good citizens */ sE.enroll_yyyyq_code = 20074 and /* current quarter only */ sR.Client_ID IS NULL ) /* Data not in Maximizer! */ or /* Executive Education Students ..................................... */ ( sE.prim_coll_code = 'GRD' and sE.dept_major_code = '296' and sE.status_code = 1 and /* Good citizens */ sE.enroll_yyyyq_code = 20074 and /* current quarter only */ sR.Client_ID IS NULL ) /* Data not in Maximizer */ /* Sort Options ........................................................... */ order By nM.last_name, nM.first_name ;
So, I'm trying to deserialize a .NET object inside a CLR procedure; I've used SGEN to make an "xmlserialization" version of the object library, and registered it and the original assembly in SQL Server and referenced them from my CLR Procedure project.
Now, I receive the object as an XML Document and I'm trying to use XMLSerializer to deserialize the XML back into my object. If I try to specify the XMLRoot when I declare the XMLSerializer and deploy it SQL gives me the (in)famous can't use dynamically created assemblies error.
I could really use any help/inspiration/assistance!!
Here's most of the code:
Dim myCaseType As CaseMessageType = CType(myRead.ReadContentAsInt(), CaseMessageType) SqlContext.Pipe.Send("Case Type=" & myCaseType.ToString()) Dim myXmlRoot As New XmlRootAttribute(CaseMessageElement) myXmlRoot.Namespace = CaseMessageSchema SqlContext.Pipe.Send("Getting the type of the message") Dim myType As System.Type = GetCaseMessageSystemType(myCaseType)
SqlContext.Pipe.Send("Cretating xml serilizer object"
) 'this "works" but it won't deserialize Dim xmlSerializer As New XmlSerializer(myType) 'this doesn't work, it gives me the error 'Dim xmlSerializer As New XmlSerializer(myType, myXmlRoot) SqlContext.Pipe.Send("Deserialize the message") myCase =