XML Schema Collection Question

Nov 13, 2007

If I have N different xml document formats and I want to store those xml data files as typed xml in one table (one column), can I do it using xml schema collection (by adding schema file to schema collection for each document type and assigning xml schema collection to this column)?

Is this possible using xml schema collection? Or did I miss something about xml schema collection usage scenario?



Thank you!

View 4 Replies


ADVERTISEMENT

Adding A XML Schema To XML Schema Collection

Apr 19, 2006

I used SSEUtil to add a schema to my database but I am having problems.  Used these steps:SSEUtil -c> USE "c:Rich.mdf"> GO>!RUN Resume.SQL//indicates success>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS>GO//schema not shown in list> USE master>GO>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS>GO//schema is shown in the queryIt appears that the schema is not added to the desired database, so when I try to use the schema in Visual Studio, the schema does not appear when I connect to the Rich.mdf database.  Any ideas on what I am doing wrong or why this might be happening?ThanksKevin

View 3 Replies View Related

EXEC Permission On A SCHEMA COLLECTION???

Jan 15, 2007

I have a permissions problem with a table/procedure that I hope someone can help me with.

To set the scene .......

All my procs/tables/functions etc are owned by dbo.
I have a windows security group that is granted permissions to EXEC all procs. No one has permissions to tables.
I have a table that has an XML column and the column has a schema collection bound to it.
The table has a computed column that relies on a function to extract a datetime element from the XML in the XML column and I have an index on this computed column.
I have a proc that selects from this table and uses the computed date column for filtering. However, the select statement is build dynamically and uses sp_execute to perform the SELECT. This of course breaks the ownership chain.
To fix the above I have a user that was created from a certificate and the above proc is signed with the certificate. The user is granted select privileges on the table. This fixes the problem. (In fact, all procs/functions/triggers are signed in this way).

Now (finally) the problem ....

When I run the above proc as admin, it works fine.

When I run it as a member of the security group (mentioned earlier) I receive ...

EXECUTE permission is denied on object 'my_schema_collection', database 'mydb', schema 'dbo'

The 'my_schema_collection' mentioned above is the schema collection to which my xml column is bound.

What? How can I grant EXEC permission to a schema collection?

Anyone have any ideas?

Thanks,

~swg

View 4 Replies View Related

Problem With Using Dynamic SQL To CREATE XML SCHEMA COLLECTION In SQL 2005

Apr 8, 2008

This works in SQL Server 2005:CREATE XML SCHEMA COLLECTION Version2_1 AS'<xs:schema xmlns="http://www.icpsr.umich.edu/DDI"     xmlns:xs="http://www.w3.org/2001/XMLSchema"    xmlns:doc="http://www.icpsr.umich.edu/doc"     targetNamespace="http://www.icpsr.umich.edu/DDI"    elementFormDefault="qualified" attributeFormDefault="unqualified">    <xs:annotation>        <xs:documentation>            This is a w3c Schema "Technical Implementation" of the DDI Conceptual Specification.             This schema is intended for use in producing electronic versions of codebooks for quantitative social science data.            CVS Revision information: $Header: /cvsroot/ddi-alliance/ddi/w3c/Version2-1.xsd,v 1.10 2007/07/31 19:03:54 mdiggory Exp $         </xs:documentation>    </xs:annotation></xs:schema>'  This version, however, gives errors: DECLARE @sql VARCHAR(max)SET @sql ='CREATE XML SCHEMA COLLECTION Version2_1 AS <xs:schema xmlns="http://www.icpsr.umich.edu/DDI" xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:doc="http://www.icpsr.umich.edu/doc" targetNamespace="http://www.icpsr.umich.edu/DDI"elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:annotation>    <xs:documentation>        This is a w3c Schema "Technical Implementation" of the DDI Conceptual Specification.         This schema is intended for use in producing electronic versions of codebooks for quantitative social science data.        CVS Revision information: $Header: /cvsroot/ddi-alliance/ddi/w3c/Version2-1.xsd,v 1.10 2007/07/31 19:03:54 mdiggory Exp $     </xs:documentation></xs:annotation></xs:schema>'EXEC (@sql)Ultimately, I am trying to create a stored procedure that will take as parameters the name of the new schema and the .xsd file it comes from, so that I can use it in code.  I am a novice, so all explanations would be greatly appreciated.Thanks,Ed Graham 

View 3 Replies View Related

SQL Server Admin 2014 :: How To Get XML Schema Collection Definition

Oct 29, 2015

I am trying to copy the table data from db to another db, because some tables has XML column with a schema collection, I would like to get difinition of the XML schema collection and create it on the target db, otherwise I will get below error:

Xml columns cannot refer to schemata across databases.

My plan is for those tables with xml column with schema collection, I will:

1. Get all tables/columns that requires xml schema

SELECT t.name AS table_name,
SCHEMA_NAME(t.schema_id) AS schema_name,
c.name AS column_nam,
c2.name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
inner join sys.xml_schema_collections c2 on c.xml_collection_id = C2.xml_collection_id

2. Get table definition

DECLARE
@object_name SYSNAME
, @object_id INT
, @SQL NVARCHAR(MAX)
SELECT
@object_name = '[' + OBJECT_SCHEMA_NAME(o.[object_id]) + '].[' + OBJECT_NAME([object_id]) + ']'
, @object_id = [object_id]
FROM (SELECT [object_id] = OBJECT_ID('TableName', 'U')) o

[code].....

3. Get XML Schema definition

4. Combine 2 and 3.

5 insert into newtable select .... cast(xmlColumnas xml) from OldDB.dbo.oldtable

I am stuck at step 3 now....

View 3 Replies View Related

SSIS- The Element Cannot Be Found In A Collection. This Error Happens When You Try To Retrieve An Element From A Collection On A

May 19, 2008

hi,

this is sanjeev,
i have SSIS package, using my c# program i want to add one execute package task to this package's sequence container.


it is creating the new package with out any probelm. but when i opened the package and try to move the newly created exeute package task it is giving the following error.


the element cannot be found in a collection. this error happens when you try to retrieve an element from a collection on a container during the execution of the package



this is my code



{
Package pkg = new Package();
string str = (string)entry.Key;
pkg.Name = str;
alEntity = (ArrayList)entry.Value;

ConnectionManager conMgr;
Executable chPackage;
TaskHost executePackageTask;

Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();



//string PackagePath = @"c:Genesis.dtsx";

//p = app.LoadPackage(PackagePath, null);
p = new Package();
p.LoadFromXML(parentPackageBody, null);


p.Name = str;

//Sequence seqContainer;

IDTSSequence seqContainer;
//seqContainer = (Sequence)p.Executables["Extract Genesis Data"];
seqContainer = ((Sequence)p.Executables[0]);

string packageLocation = @"Geneva Packages";
conMgr = p.Connections["SQLChildPackagesConnectionString"];






foreach (string val in alEntity)
{
if (seqContainer.Executables.Contains("Load_" + val) == false)
{
chPackage = seqContainer.Executables.Add("STOCK:ExecutePackageTask");



executePackageTask = (TaskHost)chPackage;
executePackageTask.Name = "Load_" + val;
executePackageTask.Description = "Execute Package Task";


executePackageTask.Properties["Connection"].SetValue(executePackageTask, conMgr.Name);
executePackageTask.Properties["PackageName"].SetValue(executePackageTask, packageLocation + ddlApplication.SelectedItem.Text + @"" + executePackageTask.Name);



}
}


app.SaveToXml(Server.MapPath("../SynchronizeScript/Packages/" + ddlApplication.SelectedItem.Text + @"") + str + ".dtsx", p, null);
}






please let me know what is the wrong in my code.

thanks in advance.

regards
sanjeev bolllina
sanjay.bollina@gmail.com

View 14 Replies View Related

The 'System.Web.Security.SqlMembershipProvider' Requires A Database Schema Compatible With Schema Version '1'.

Sep 27, 2007

Locally I develop in SQL server 2005 enterprise. Recently I recreated my db on the server of my hosting company (in sql server 2005 express).I basically recreated the tables and copied the data in it.I now receive the following error when I hit the DB:The 'System.Web.Security.SqlMembershipProvider' requires a
database schema compatible with schema version '1'.  However, the
current database schema is not compatible with this version.  You may
need to either install a compatible schema with aspnet_regsql.exe
(available in the framework installation directory), or upgrade the
provider to a newer version.I heard something about running aspnet_regsql.exe, but I dont have that access to the DB. Also I dont know if this command does anything more than creating the membership tables and filling it with some default data...Any other solutions/thought on what this can be?Thanks!

View 4 Replies View Related

Transferring Objects Form Schema A To Schema B In One Shot....!

May 27, 2008

I have 35+ tables and 15+ stored procedures with SchemaA, now I want to transfer them to SchemaB.

I know how to do one by one...!

alter schema SchemaB transfer
SchemaA.TableA

but it will take long time...!

Thanks,

View 3 Replies View Related

Database Schema Compatible With Schema Version '1'

Apr 12, 2008

Hello everybody!I'm using ASP.NET  3.5,  MSSQL 2005I  bought virtual web hosting .On new user registrations i have an error =(The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version. On my virtual machine it work fine but on web hosting i have an error =(What can you propose to me?

View 2 Replies View Related

Moving Data From One DB Schema To Another DB Schema Using SSIS

May 8, 2007

Hello,



I would like to use SSIS tool to move the data from one database schema to another database schema.



For example:



Source table has

1. UserName (varchar 20) (no null)

2. Email (varchar 50) (can be null)



Destination table has



1. UserID (uniqueidentifier - GUID)

2. UserName (varchar 50) (no null)

3. EmailAddress (nvarchar 50) (can be null)

4. DateTime



Questions:



1. What controls do I use in my Data Flow to make data move between databases with different data types and include new value in UserID as a new GUID and DateTime as a date (GETDATE)?

OLE DB Source, OLE DB Destination, Data Converson and .....

How do I insert Guid and Date at the same time?





2. I have many tables to do data moving. Any sugestions? How do I architect my project? If I create many data flows for each table - it will look complicated.



Please give me some advices here.



Thanks.

View 3 Replies View Related

Copy Objects From One Schema To Another Schema?

Nov 21, 2011

I am using sql server 2008 R2.I want to copy all the objects of one schema and put it in another schema. I want to do that from command prompt.

In oracle we can export the objects of one user and import to another user using exp and imp. I want similar type.

View 5 Replies View Related

Which Collection

Jan 28, 2008

i want to use datebase wich suport all latin languages but i cant find the collection
esspeacily
eng,
german,
france and Turksh

View 4 Replies View Related

Database Collection

Feb 27, 2004

I recently migrated a database from server A to server B. The backup jobs I am trying to build on server B are failing because of the following error:
--------------
[Microsoft SQL-DMO] Error 21776: [SQL-DMO]The name 'WinDat' was not found in the Databases collection. If the name is a qualified name, use [] to separate various parts of the name, and try again.
-------------

How do I add this database to the databases collection so it will be recognized?

Thanks in advance for your time and help.

View 9 Replies View Related

ReportItems Collection

Aug 16, 2007

I can add two reportitem controls, ie reportitems!begbal.value + reportitems!deposits.value, without a problem. However, when I add the 3rd reportitem control to the expression, ie + reportitems!withdrawals.value, some really funky arithmetic occurs. All of these controls I am referring to are in the same group footer.

Any help out there would be greatly appreciated.

View 1 Replies View Related

NameValueCollection How To Add In Collection Using Loop

Feb 9, 2007

actuallu  the earlier obviously worked but now i am fetching values from 2 colums and in collection we can pass 2 strings i did that.but then how to increment the collection c.will just post the code .
query fetching 2 records
can add only 1
NameValueCollection c = new NameValueCollection();
cmd2.CommandText="select  Pname ,HoursWorked   from TimeSheet1 ts , ProjResource pr,ProjectDetails pd where ts.rid = pr.rid and ts.pcode=pr.pcode and pd.Pcode = ts.Pcode and pr.Rid = '" + Ridtxt.Text + " '";
cmd2 .Connection = con1;
con1.Open();
SqlDataReader dr = cmd2.ExecuteReader();
 
while (dr.Read())
{
c.Add(dr["pname"].ToString(), dr["hoursworked"].ToString());
}
 
as earliar 
supose c#  12
asp 11
only c# getting added
even though loop is while dr.read()
{
 }
actually how to increment key as in c  both strings are occupied

View 3 Replies View Related

Some Problems With Garbage Collection

Jul 3, 2004

hi evryone
I have a question!
in my ASP.NET page I use a SqlDataAdapter object for working on my database
first I declare it as a global vaiable(SqlDataAdapter objDataAdapter;)
then I construct it in my Page_Load procedure like this
(objDataAdapter=new SqlDataAdapter(strSql,objConnention))
then when I want to use it in my other procedures an error tells me that your object does not exist
for solving this error I should construct my objDataAdapter in evry procedure using it.
but I think such variables should not be erased from Heap automatically(with Garbage Collection)
because it has a reference to Stack. I mean the global variable...
any opinion ?
Thanks

View 3 Replies View Related

Pass A Collection To A SPROC

Feb 12, 2005

I am collecting companyID's form a data grid, I want to pass the selected values to a sproc via a variable. Any idea on the syntax?

this works using a query string within my code

WHERE (dbo.Promotions.ExpirationDate > GETDATE()) AND (dbo.Promotions.CompanyID IN (" + selectedCompanies + "))

this doesn't within my sproc

WHERE (dbo.Promotions_ByLink.ExpirationDate > GETDATE()) AND (dbo.Promotions_ByLink.CompanyID IN (@SelectedCompanies))

I also tried

WHERE (dbo.Promotions_ByLink.ExpirationDate > GETDATE()) AND (dbo.Promotions_ByLink.CompanyID IN (SELECT @SelectedCompanies))

and

WHERE (dbo.Promotions_ByLink.ExpirationDate > GETDATE()) AND (dbo.Promotions_ByLink.CompanyID IN (' + @SelectedCompanies + '))

Thanks

View 4 Replies View Related

Changing The Unicode Collection

Oct 26, 2000

hi , what is the script to change the unicode collection in sql server 7.0
Ahemd

View 1 Replies View Related

ADO Does Not Add To Errors Collection After The Second FETCH NEXT In A SP

Feb 6, 2006

I'm having trouble obtaining errors raised in a stored
procedure via the ADO Errors collection after the second
FETCH NEXT statement from within that stored procedure.


Consider the following table created in a SQL Server
database:


CREATE TABLE TestTable
(
TestInt int
)
go


INSERT TestTable(TestInt) values(1)
INSERT TestTable(TestInt) values(2)
INSERT TestTable(TestInt) values(3)


This is a very simple table with one column, and three
rows containing the values 1, 2 and 3.


Consider this stored procedure:
CREATE PROCEDURE TestStoredProc
as
BEGIN
set rowcount 0
Set NoCount ON


declare @TestInt int
declare @ErrMsg char(7)
declare TestCursor cursor forward_only for
select * from TestTable


open TestCursor
Fetch next from TestCursor into @TestInt


While @@fetch_status<>-1
Begin
select @ErrMsg = 'Error ' + convert(char, @testint)
raiserror(@ErrMsg, 16, 1)
raiserror(@ErrMsg, 16, 1)
Fetch next from TestCursor into @TestInt
end


Close TestCursor
DeAllocate TestCursor
return
END


This stored procedure simply defines a cursor on all rows
in TestTable. For each row fetched from the cursor, the
error message 'Error n' is raised twice, where n is the
integer that had just been fetched from the cursor.


Finally, consider this VB code using ADO to execute the
above stored procedure. After the stored procedure is
executed, the code loops through the errors collection,
and creates a message box for each error in the collection:


Private Sub Form_Load()
Dim cn As Connection
Dim cm As Command
Dim oErr As Error


On Error Resume Next


Set cn = CreateObject("ADODB.Connection")
cn.Open "Data Source=<Some SQL Server>; Initial
Catalog=<Some Database Name>; Provider=SQLOLEDB; Persist
Security Info=False; Integrated Security=SSPI"


Set cm = CreateObject("ADODB.Command")
Set cm.ActiveConnection = cn
cm.CommandType = adCmdStoredProc
cm.CommandText = "TestStoredProc"
cm.Execute


For Each oErr In cn.Errors
MsgBox oErr.Description
Next


End
End Sub


When this code is executed, only two message boxes appear
with the message "Error 1".


Any help on this matter would be greatly appreciated :)

View 3 Replies View Related

Data Collection From Many To One Servers

Mar 7, 2008

I need to feed head office sql server with the data from regional servers. Servers are spread through all continents
Data input done locally on Head office server as well and plus need to ship data from other servers.
So clarify this - Head office server is not standby one. Mirroring is out of the picture, I think..
Initially, I thought ship a log every 15 min and restore on Head office server but is this going to create an issue for the local data processing?

Any bright ideas welcome!

View 2 Replies View Related

Collection Of Stored Procedures

Apr 7, 2008



Is it possible to address the whole set of user stored procedures in one command?

For example, I want to GRANT EXEC on all sprocs in my db; can I do it in one command or do I have to do the GRANT for each sproc individually?

View 19 Replies View Related

Not Sure What Variables Collection Are And How Toset Them

Mar 27, 2008



Precedence Constraint Editor Values:
Expression Operation: Expression and Constraint
Value: Failure
Expression: @GotRecs == 1
Radio button: Logical AND. All contraints must evaluate to True

Stored Procedure has an IF (that contains a SELECT) statement that checks for records if no records are returned processing stops. I SET the parameter after the BEGIN that follows the IF statement.

The step that contains the above code is step #3. I placed the constraint between step #3 and step #4 (Data Flow task) just Exports to a Flat File.

When I clicked the TEST button in the Precedence Constraint Editor I got the following msg:
Error at Constraint 3: The variable €śGotRecs€? was not found in the variables collection. The variable might not exist in the correct scope.

View 12 Replies View Related

How Can I Return A Collection Instead Of A SqlDataReader?

Jan 12, 2008

I have to create a CLR Proc for Reporting Services report that will use SharePoint (MOSS 2007) assemblies, so my datasource won't be a database, but the SharePoint object model that returns a collection.

How can I return these data (it's not necessary to be a collection exactly) without having to create a temp table just to return the SqlDataReader?

Thanks.

And sorry for my previous message, I just forgot that I was posting a message at the Global MSDN forums.

View 1 Replies View Related

SQL 2012 :: Data Collection (MDW) - TempDB

Mar 30, 2014

It is possible that Data Collection can cause massive increasing MB/sec to tempdb ? I cannot find connection with tempdb and I set cash file, but on same disk.

Or it can be something different? Last two weeks what I checked was Read/Write MB/s to tempdb increasing progressively.

One time it was about 20MB/sec

After it was reseting and again 1MB/sec..

What I checked , External company which install SQL Server made one file for tempdb, next week or during breaktime(it will be possible), I would like make 8files next weekend work.

Now I saw that TempDB mdf was still increased, but using was just 8-10%

View 2 Replies View Related

[SQL-DMO]The Name 'tdb_grabowy1' Was Not Found In The Databases Collection.

Jul 20, 2005

We need to copy about 25 databases whenever we get a new softwaredelivery. Currently, the process is to manually use the DTS databasecopy wizard.Doing some research, I created a DTS package to copy databases. Butthis was not going to work since I have to hard code the databasenames in the package. Back to RTFMing, I discovered the DynamicProperties Task. So now I setup a .bat file that calls dtsrun and viaglobal variables passes in the source and target database names to thecopy db DS package.I did a simple test against a test database that I have and it worked.But when I tried it against some "real" databases I get the followingerrors. I have searched and googled but I have not found anything.Help???DTSRun OnError: Copy SQL Server Objects, Error = -2147199728(80045510)Error string: [SQL-DMO]The name 'tdb_grabowy1' was not found in theDatabases collection. If the name is a qualified name, use [] toseparate various parts of the name, and try again.Error source: Microsoft SQL-DMOHelp file: SQLDMO80.hlpHelp context: 1131

View 2 Replies View Related

Non-existing Field In Fields Collection

Apr 11, 2007

I'm developing a report in RS 2000 that uses two datasets. The first dataset provides data to a drill-down report on the top part of the screen and the second small dataset provides some data for additional summary information on the bottom of the screen. I'm getting a runtime error "An unexpected error occurred in Report Processing. The expression referenced a non-existing field in the fields collection." Of course, I've edited every expression I can think of: text boxes, data grid, parameters, filters, drill-down lists... I think I've gone through every object on the report but I can't isolate the bad expression. Can anyone suggest a better way to debug this type of error? It compiles fine, but fails in runtime. thanks.

View 1 Replies View Related

Dts.Variables Collection, Threading, And Contention

Apr 29, 2008

All,

We are experiencing some problems when running the same package on multiple threads of a C# application concurrently. The package instances seem to share a Dts.Variables collection.

I have created a test application and package to reproduce the issue. The package is very simple. It has two variables - Instance (Int32) and Content (string). The test application runs two concurrent threads that run through 25 iterations running the package. Each thread loads the package, sets the instance, and then runs the package. The package then takes the instance, sticks it in the Content variable and then writes it to a file called "FileX" where X is the Instance. Thread 1 sets the instance from 1 to 25, thread 2 sets it from 26 to 50. The test execution results in about 15% of the files containing the incorrect "instance content". That is, I'll see "42" in the file named "File14", or something along those lines. This tells me that the variables are being overwritten.

I ran another test where I created a copy of the package, so the code is identical, but the VersionGUID is different. Running the thread test application always succeeds. There is no file name/content mismatch. I then ran another test where I manually edit the XML of the package to change the VersionGUID before the package is loaded (by calling LoadFromXml). Again this never fails.

Changing the VersionGUID may work for us, but it is a total hack. Has anyone else experienced this or have any other solutions? Any thoughts on manually updating the VersionGUID to get around this problem? I hate doing this, but we are getting desperate.

Thanks in advance,

Rob

View 2 Replies View Related

Getting The Database Collection Doesnt Always Wrok

Sep 24, 2006

why doesn't this code always work?

<code>

Dim conn as serverconnection=New serverconnection(".SQLEXPRESS")

Dim srv as new server(conn)

Dim db as database

for each db in srv.databases

cmbDBfilenames.items.add(db.Name.tostring)

Next

</code)

If the databases are located in the applicatio path , it doesn't pick them up



View 1 Replies View Related

Index Was Out Of Range. Must Be Non-negative And Less Than The Size Of The Collection.

May 25, 2008

I'm Using a CLR for creating a trigger on database tables, 
This is my Exception :
A .NET Framework error occurred during execution of user defined routine or aggregate 'AvailableFlightTrgg': System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.ArgumentOutOfRangeException: at System.Collections.ArrayList.get_Item(Int32 index) at Triggers.AvailableFlightTrgg() . A .NET Framework error occurred during execution of user defined routine or aggregate 'AvailableFlightInsert': System.Data.SqlClient.SqlException: A .NET Framework error occurred during execution of user defined routine or aggregate 'AvailableFlightTrgg': System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.ArgumentOutOfRangeException: at System.Collections.ArrayList.get_Item(Int32 index) at Triggers.AvailableFlightTrgg() . INSERT [SamaCRSHistory].[dbo].[AvailableFlight] VALUES ('283','50','23','4','2','6','15','1','5','4','5/25/2008 8:30:00 AM','5/25/2008 7:00:00 AM','6/26/2008 12:00:00 AM','5','AR2580','125','0','False','False','1','Flight created on 5/25/2008 00:00:00','1', 'I', GETDATE()); INSEA .NET Framework error occurred during execution of user defined routine or aggregate 'AvailableFlightTrgg': System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.ArgumentOutOfRangeException: at System.Collections.ArrayList.get_Item(Int32 index) at Triggers.AvailableFlightTrgg() . A .NET Framework error occurred during execution of user defined routine or aggregate 'AvailableFlightInsert': System.Data.SqlClient.SqlException: A .NET Framework error occurred during execution of user defined routine or aggregate 'AvailableFlightTrgg': System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.ArgumentOutOfRangeException: at System.Collections.ArrayList.get_Item(Int32 index) at Triggers.AvailableFlightTrgg() . INSERT [SamaCRSHistory].[dbo].[AvailableFlight] VALUES ('283','50','23','4','2','6','15','1','5','4','5/25/2008 8:30:00 AM','5/25/2008 7:00:00 AM','6/26/2008 12:00:00 AM','5','AR2580','125','0','False','False','1','Flight created on 5/25/2008 00:00:00','1', 'I', GETDATE()); INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','7','125','125','0','0','Flight created on 5/25/2008 00:00:00','1'); INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','4','25','25','20','20','Flight created on 5/25/2008 00:00:00','1'); The statement has been terminated. System.Data.SqlClient.SqlException: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnectionSmi.EventSink.DispatchMessages(Boolean ignoreNonFatalMessages) at Microsoft.SqlServer.Server.SmiEventSink_Default.DispatchMessages(Boolean ignoreNonFatalMessages) at System.Data.SqlClient.SqlCommand.RunExecuteNonQuerySmi(Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteToPipe(SmiContext pipeContext) at Microsoft.SqlServer.Server.SqlPipe.ExecuteAndSend(SqlCommand command) at StoredProcedures.AvailableFlightInsert(Decimal AvailableFlightTimeTableID, Decimal Availabl... INSERT [SamaCRSHistory].[dbo].[AvailableFlight] VALUES ('283','50','23','4','2','6','15','1','5','4','5/25/2008 8:30:00 AM','5/25/2008 7:00:00 AM','6/26/2008 12:00:00 AM','5','AR2580','125','0','False','False','1','Flight created on 5/25/2008 00:00:00','1', 'I', GETDATE()); INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','7','125','125','0','0','Flight created on 5/25/2008 00:00:00','1'); INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','4','25','25','20','20','Flight created on 5/25/2008 00:00:00','1');RT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','7','125','125','0','0','Flight created on 5/25/2008 00:00:00','1'); INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','4','25','25','20','20','Flight created on 5/25/2008 00:00:00','1'); The statement has been terminated. System.Data.SqlClient.SqlException: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnectionSmi.EventSink.DispatchMessages(Boolean ignoreNonFatalMessages) at Microsoft.SqlServer.Server.SmiEventSink_Default.DispatchMessages(Boolean ignoreNonFatalMessages) at System.Data.SqlClient.SqlCommand.RunExecuteNonQuerySmi(Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteToPipe(SmiContext pipeContext) at Microsoft.SqlServer.Server.SqlPipe.ExecuteAndSend(SqlCommand command) at StoredProcedures.AvailableFlightInsert(Decimal AvailableFlightTimeTableID, Decimal Availabl... INSERT [SamaCRSHistory].[dbo].[AvailableFlight] VALUES ('283','50','23','4','2','6','15','1','5','4','5/25/2008 8:30:00 AM','5/25/2008 7:00:00 AM','6/26/2008 12:00:00 AM','5','AR2580','125','0','False','False','1','Flight created on 5/25/2008 00:00:00','1', 'I', GETDATE()); INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','7','125','125','0','0','Flight created on 5/25/2008 00:00:00','1'); INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('283','4','25','25','20','20','Flight created on 5/25/2008 00:00:00','1');
This is my Code :case TriggerAction.Insert:using (SqlConnection connection = new SqlConnection(@"context connection=true"))
{
connection.Open();command = new SqlCommand(@"SELECT * FROM INSERTED;", connection);
dr = command.ExecuteReader();
dr.Read();AvailableFlightID = (Decimal)dr[0];
AvailableFlightTimeTableID = (Decimal)dr[1];AvailableFlightAirlineID = (Decimal)dr[2];
AvailableFlightRoutingID = (Decimal)dr[3];AvailableFlightAPTerminalIDOrg = (Decimal)dr[4];
AvailableFlightAPTerminalIDDest = (Decimal)dr[5];AvailableFlightAirCraftID = (Decimal)dr[6];
AvailableFlightFlightStatusID = (Decimal)dr[7];AvailableFlightCateringID = (Decimal)dr[8];
AvailableFlightPayLoadTableID = (Decimal)dr[9];AvailableFlightArrTime = (DateTime)dr[10];
AvailableFlightDeptTime = (DateTime)dr[11];AvailableFlightDate = (DateTime)dr[12];
AvailableFlightDayName = (int)dr[13];AvailableFlightFlightNo = (String)dr[14];
AvailableFlightCapacity = (int)dr[15];AvailableFlightFreeBaggage = (int)dr[16];
AvailableFlightHaveChild = (bool)dr[17];AvailableFlightHaveParrent = (bool)dr[18];
AvailableFlightCommissionPercent = (int)dr[19];AvailableFlightRemark = (String)dr[20];AvailableFlightUserID = (Decimal)dr[21];
dr.Close();f (AvailableFlightID != 0)
{command = new SqlCommand(@"INSERT [SamaCRSHistory].[dbo].[AvailableFlight] VALUES ('" + AvailableFlightID + @"','" + AvailableFlightTimeTableID + @"','" + AvailableFlightAirlineID + @"','" + AvailableFlightRoutingID + @"','" + AvailableFlightAPTerminalIDOrg + @"','" + AvailableFlightAPTerminalIDDest + @"','" + AvailableFlightAirCraftID + @"','" + AvailableFlightFlightStatusID + @"','" + AvailableFlightCateringID + @"','" + AvailableFlightPayLoadTableID + @"','" + AvailableFlightArrTime + @"','" + AvailableFlightDeptTime + @"','" + AvailableFlightDate + @"','" + AvailableFlightDayName + @"','" + AvailableFlightFlightNo + @"','" + AvailableFlightCapacity + @"','" + AvailableFlightFreeBaggage + @"','" + AvailableFlightHaveChild + @"','" + AvailableFlightHaveParrent + @"','" + AvailableFlightCommissionPercent + @"','" + AvailableFlightRemark + @"','" + AvailableFlightUserID + @"', '" + "I" + @"', " + "GETDATE()" + @");", connection);
pipe.Send(command.CommandText);
command.ExecuteNonQuery();command = new SqlCommand(@"SELECT TimeTableSubClassSubClassID , TimeTableSubClassMaxCapacity, TimeTableSubClassWaitListCapacity FROM [SamaCRS].[dbo].[TimeTableSubClass] Where TimeTableSubClassTimeTableID = '" + AvailableFlightTimeTableID + "'", connection);
dr = command.ExecuteReader();
 System.Collections.ArrayList SubClassIDList = new System.Collections.ArrayList();
System.Collections.ArrayList SubClassCapacityList = new System.Collections.ArrayList();System.Collections.ArrayList SubClassWaitListCapacityList = new System.Collections.ArrayList();while (dr.Read())
{
SubClassIDList.Add(dr["TimeTableSubClassSubClassID"]);SubClassCapacityList.Add(dr["TimeTableSubClassMaxCapacity"]);SubClassWaitListCapacityList.Add(dr["TimeTableSubClassWaitListCapacity"]);
}
dr.Close();
SubClassIDList.TrimToSize();
SubClassCapacityList.TrimToSize();
SubClassWaitListCapacityList.TrimToSize();int CountID = SubClassIDList.Count;for (int i = 0; i <= CountID; i++)
{
command = new SqlCommand(@"INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('" + AvailableFlightID + @"','" +SubClassIDList[i] + @"','" +
SubClassCapacityList[i] + @"','" + SubClassCapacityList[i] + @"','" +
SubClassWaitListCapacityList[i] + @"','" + SubClassWaitListCapacityList[i] + @"','" +
AvailableFlightRemark + @"','" + AvailableFlightUserID + @"');", connection);
pipe.Send(command.CommandText);
command.ExecuteNonQuery();
}
 
////----------------------------------------
}
 
}
break;
 
this Code doesnt Work , but before writing this one I used the Code Below and It was working perfectly,
Previous Working Code :
//Initialize all TimeTable Classes for Created Flightcommand = new SqlCommand(@"SELECT TimeTableSubClassSubClassID FROM [SamaCRS].[dbo].[TimeTableSubClass] Where TimeTableSubClassTimeTableID = '" + AvailableFlightTimeTableID + "'", connection);
dr = command.ExecuteReader();
 System.Collections.ArrayList SubClassIDList = new System.Collections.ArrayList();while (dr.Read())
{
SubClassIDList.Add(dr.GetValue(0));
}
dr.Close();
SubClassIDList.TrimToSize();foreach (object AvailableFlightSubClassID in SubClassIDList)
{command = new SqlCommand(@"INSERT [SamaCRS].[dbo].[AvailableFlightSubClass] VALUES ('" + AvailableFlightID + @"','" + AvailableFlightSubClassID + @"','" + AvailableFlightCapacity + @"','" + AvailableFlightCapacity + @"','" + 0 + @"','" + 0 + @"','" + AvailableFlightRemark + @"','" + AvailableFlightUserID + @"');", connection);
pipe.Send(command.CommandText);
command.ExecuteNonQuery();
}
 
Can ANy one Help me with this Exception , I have Checked The Tables for Number of Columns , its not from Column numbers ,I Think iys from For() Loop????????
 
 
 

View 1 Replies View Related

Realtime Data Collection - How Do I Put SQL7 In Charge?

Feb 6, 2000

I have a product where we feed an SQL 7 DB data collected from Manufacturing. Presently, the Data transport Program is in charge of getting prepared data from machines and inserting into the DB. This design assumes SQL7 is always ready and able - which is not true due to customer queries or backups or etc. consuming resources. There is a low level buffer in system at manufacturing level if transport dies, but transport is ignorant of SQL distress, so keeps hammering DB's frontdoor. I'm looking for help in putting SQL server in charge of allowing data in - when resources are adequate. Seems I need a function that can determine server stress QUICKLY to forestall transport program and a buffer for records at the transport layer. Anyone know / done a system where SQL server CHECKS for waiting records or OK's an external program to send until told to stop? What indicates (reliably) low server resources? Anyone ever used MSMQ?


"Black Holes are proof SOMEBODY, SOMEWHERE really did have a particularly bad Y2K problem!"

View 7 Replies View Related

[howto] Write A Function That Process Row Collection

Mar 31, 2004

something like max,min?
help please!!!

View 5 Replies View Related

SQL 2012 :: Data Collection Centralized Database - MDW

Apr 17, 2014

I Enabled Data Collection on one of the server and planned to make it as Centralised Management Data Warehouse I configured data collection on it and can view reports. Next, I went to other server and configured "Set up data collection" to use my first instance as the centralised Database. But the issue is I can only see reports of first server. Am I missing something here.

I did exactly as explained in this video [URL] .....

View 9 Replies View Related

Com Exception When Removing ErrorOutPut Column From The Collection.

May 16, 2006



OutCollection[1] holds the erroroutput columncollection.

metaData.OutputCollection[1].OutputColumnCollection.RemoveObjectByID(errOutputCol.ID);

some times 1 Or 2 columns gets deleted, after that the exception is raised.

View 1 Replies View Related







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