Filling A Table In Sqlserver2005
Apr 9, 2008
hello everyone
i have created a table in sqlserver2005 named "Departments" - in this table different departments of a telephone ( landline ) company are to be stored,which deals with complaints registered to them by there users.
i want to know the name of these different departments which deals with complaints assigned to them like if i do have complaint from a user who has problem with his handset then that complaint will be assigned to "Maintance dept."
as i was never in indusrty , i need the help in filling the table.
just do write me name of departments and the nature of complaints wh they deal with!!!
thanks for the consideration
View 1 Replies
ADVERTISEMENT
May 12, 2007
hi
COMPUTER-1
IP ::::: 129.100.100.5
COMPUTER NAME IS ::::: HASH
MEMBER OF DOMAIN
in this computer sqlserver express edition is installed, i want to remove this express becoz in configuration manager it show two SQLSERVER'S are running. when i browse from COMPUTER - 2 for network servers it show server name as HASH/SQLEXPRESS, but not the main SQLSERVER.
COMPUTER -2
IP::::129.100.100.142
COMPUTER NAME::: FEROZ
MEMBER OF WORKGROUP
can anyone help me how to connect these two computers and remove this express edition
iam new to sqlserver configuration
thanks in advance
waiting for eager reply
View 1 Replies
View Related
May 18, 2006
Hi there I need to fill database table randomly with 5 ordered numbers such as 43566 , 78578 , 92565 , .. to gain approximately 100000 row of a table . Is there a query ?
View 7 Replies
View Related
Jan 4, 2007
When I run the code below, I get
a table with "In order to evaluate an indexed property, the property
must be qualified and the arguments must be explicitly supplied by the
user." as the contents...
Public Function ReturnTable(ByVal strName As String, ByVal alParameters As ArrayList, ByVal strTable As String) As DataSet
Dim sqlSP As New SqlCommand
sqlSP.CommandTimeout = 120
sqlSP.Connection = sqlConn
sqlSP.CommandType = CommandType.StoredProcedure
sqlSP.CommandText = strName
AddParameters(sqlSP.Parameters, alParameters)
Dim dsDataSet As New DataSet()
sqlConn.Open()
Dim sqlDataAdapter As New SqlDataAdapter(sqlSP)
sqlDataAdapter.Fill(dsDataSet, strTable)
sqlConn.Close()
Return dsDataSet
End Function
AddParameters is a function which adds each of the parameters in the
array list to the sqlSP parameter collection... In SQL Profiler, the sp
is called and runs and returns results... But a dataset with one table
and the above msg is returned...
View 2 Replies
View Related
Apr 17, 2008
Hi,
I am using Sql Server 2005.
I want to place a LOCK, insert something in the table then return back to the code (with the ID of the inserted item) and then call FUNCTION_A and then based on the outcome of the function I either want to
I want to keep the inserted item and release the lock or
I want to delete the inserted item and release the lock
Any suggestion is greatly appreciated.
Regards
naimulah
View 3 Replies
View Related
Sep 25, 2007
Hi,
I have a table called "tblProducts" with following fields:-
ProductID(Pk, AutoIncrement), ProductCode(FK), ProdDescr.
So to the above table I have added a new field/column named "ProdLongDescr(varchar, Null)"
So, I need to populate this newly added column with specific values for each row depending on "ProductCode" which is different forevery row. The problem is that I have 25 rows.So instead of Writing 25 individual update scripts, is there a way in which single query will do the same job instead of writing one update query for each row ?. If so can some one guide me how to achieve that OR point to me a good resource.
Below are a couple of Individual update scripts I Wrote. "ProductCode" is different for all 25 rows.
Update tblValAdPackageElement SET ProdLongDescr = 'Slideshows' WHERE ProductCode = 'SLID'
And szElementDescr='Slideshow'
if @@error <> 0
begin
goto ErrPos
end
Update tblValAdPackageElement SET ProdLongDescr = 'CategorySlideshows' WHERE ProductCode = 'SLDC'
And szElementDescr='CategorySlideshow'
if @@error <> 0
begin
goto ErrPos
end
Thanks,
View 1 Replies
View Related
Jan 29, 2008
Hi,
While working with security feature of SQLServer2005 i came across a unforeseen doing of SQLServer2005 Connection table.
On executing the Query
select login_name,host_name,program_name from sys.dm_exec_sessions where session_id>25
I see a record with no hostname and Program name bu ti see login name.Now i dont know who is connected and from which machine and Program.
login_name login_time host_name program_name
CORPMohd2_22717 2008-01-09 00:43:56.933
Please help me in knowing why SQLServer2005 behaves in such ways.
As from SOX prospective i am not able to justify the auditor what exacly it is .
Regards
Sufian
View 2 Replies
View Related
Nov 1, 2004
Hello All
I am wanting to fill a drop down list in ASP.NET using C# from a SQL database table using a stored procedure. I have my Sproc. But using ASP.NET C# I have no idea how to do this. Can someone give me a good example, and if not too much trouble, place comments in the code, and give an explanation. I am just learning ASP.NET after moving from Classic. Things are alot different.
Thank You in advnace for all your help
Andrew
View 1 Replies
View Related
Mar 21, 2008
I have a ton of data to load into a SQL 2005 database.
I just loaded a bunch of data for a number of tables using bcp, and the last table that my script loaded was an 8 million row table. The next table was a 12 million row table, and about 1 million rows into the bcp'ing a log full error was incurred. I have the batch size set to 10000 for all bcp commnads.
Here is the bcp command that failed:
"C:Program FilesMicrosoft SQL Server80ToolsBinncp" billing_data_repository..mtr_rdng_hrly_arc_t in mtr_rdng_hrly_arc_t.dat -c
-b10000 -Sxxxx -T
Here is the last part of the output from the bcp command:
...
10000 rows sent to SQL Server. Total sent: 970000
10000 rows sent to SQL Server. Total sent: 980000
10000 rows sent to SQL Server. Total sent: 990000
SQLState = 37000, NativeError = 9002
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]The transaction log for database 'billing_data_repository' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
BCP copy in failed
I thought that a commit was issued after every 10000 rows and that this would keep the log from filling up.
The log_reuse_wait_desc column in sys.databases is set to 'LOG_BACKUP' for the database being used.
Does a checkpoint need to be done more often?
Besides breaking up the 12 million row data file into something more manageable, does anyone have a solution?
How can I continue to use my same loading script, and keep the log from filling up?
Thank you.
View 9 Replies
View Related
Feb 27, 2007
I have a class that works fine using the SQLDataReader but when I try and duplicate the process using a Dataset instead of a SQLDataReader it returnsa a null value.
This is the code for the Method to return a datareader
publicSqlDataReader GetOrgID()
{
Singleton s1 = Singleton.Instance();
Guid uuid;
uuid = new Guid(s1.User_id);
SqlConnection con = new SqlConnection(conString);
string selectString = "Select OrgID From aspnet_OrgNames Where UserID = @UserID";
SqlCommand cmd = new SqlCommand(selectString, con);
cmd.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier, 16).Value = uuid;
con.Open();
SqlDataReader dtr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return dtr;
This is the code trying to accomplish the same thing with a Dataset instead.
public DataSet organID(DataSet dataset)
{
Singleton s1 = Singleton.Instance();
Guid uuid;
uuid = new Guid(s1.User_id);
string queryString = "Select OrgID From aspnet_OrgNames Where UserID = @UserID";
SqlConnection con = new SqlConnection(conString);
SqlCommand cmd = new SqlCommand(queryString, con);
cmd.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier, 16).Value = uuid;
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = cmd;
adapter.Fill(dataset);
return dataset;
}
Assume that the conString is set to a valid connection string. The Singlton passes the userid in from some code in the code behind page ...this functionality works as well.
So assume that the Guid is a valid entry..I should return a valid dataset but its null.
Additionally if I change the sql query to just be Select * From aspnet_OrgNames I still get a null value...I am assuming I am doing something wrong trying to fill the dataset.
Any help would be appreciated.
View 2 Replies
View Related
Jan 14, 2000
MS SQL Enterprise Server, SP5, running under version 6.5.
I have recently been having a problem with the TempDb database
filling up. I originally started the database at 250 Mb but
recently expanded it to 500 Mb.
My last check of the activity on the server during an event
such as this produced the following information.
- Approx. 300 connections to primarily 2 databases.
- 4 active connections:
Connection 1 -SELECT on database 1 with 13,000 records
and a record size of approx. 300 bytes.
Connection 2 -SELECT on database 1 with 13,000 records
and a record size of approx. 300 bytes.
Connection 3 -SELECT on database 2 with 550 records
and a record size of approx. 100 bytes.
Connection 4 -Replication subscriber set at 100 transactions.
My questions are:
1. What processes may cause the TempDb database to fill up?
2. What processes prevent the database from purging?
Any information would be greatly appreciated.
Jim Story
View 2 Replies
View Related
Nov 2, 1999
We are having continual problems with our transaction log filling up on one of our major applications.
Does anyone know of a way or tool to read the transaction log? We want to determine what is causing this problem.
Thanks
View 2 Replies
View Related
May 4, 1999
Recently, we converted an Access database to SQL server 6.5. One of the processes that runs against the server is
missing a commit causing temporary stored procedures to fill up TEMPDB in the sysobjects table. The only way to
clear up TEMPDB is to stop and start SQL server when the database fills up. I wrote a quick and dirty stored
procedure to delete the affending rows out of the tempdb..sysobjects table, however, the database still registers as
full after the deletes.
Question:
does anyone know of a process/DBCC I can run against the tempdb..sysobjects table to regain the space in TEMPDB
without having to stop and restart SQL Server? I need a temporary solution while the programmer is debugging the
affending code.
Thanks!
TC
View 1 Replies
View Related
Dec 5, 1998
hello,
I've got replication set up as a publisher subscriber, to basically sync a primary server with a
backup server. My distribution log keeps filling up, I've got a perf alert for now to truncate it
at 75% full for now, but why does it fill up? it's size is about 1.5 gig
My tran log for my database will also not remove about 500mb of data as well, is there any way to
see what is going on?
Thanks
View 1 Replies
View Related
Aug 2, 2007
hello, i'd need a little help with filling GridViewsi browsed over like 10 search pages, but couldnt find any which would solve my problem.so in my ajax project i made a testing page pulled a gridview (GridView1) on it with a fhew buttons and textboxes.i need to fill the gv from code so my websie.asp.cs looks like this 1 protected void Page_Load(object sender, EventArgs e)2 {3 4 5 string connstr = "Data Source=.;database=teszt;user id=user;password=pass";6 SqlConnection conn = new SqlConnection(connstr);7 SqlCommand comm = new SqlCommand("select * from users", conn);8 conn.Open();9 SqlDataReader reader;10 reader = comm.ExecuteReader();11 if (reader.HasRows)12 {13 GridView1.DataSource = reader;14 GridView1.DataBind();15 }16 reader.Close();17 conn.Close();18 comm.Dispose();19 } so i load the page and there's no gridview on the page at all, nor an error msg, the connection and the database/table is fine.any suggestions on what am i doing wrong? and i also like to know if there would be any problem with using this on a tabcontrol/tabthankyou
View 3 Replies
View Related
Oct 29, 2004
I have a table that keeps track of click statistics for each one of my dealers.. I am creating graphs based on number of clicks that they received in a month, but if they didn't receive any in a certain month then it is left out..I know i have to do some outer join, but having trouble figuring exactly how..here is what i have:
select d.name, right(convert(varchar(25),s.stamp,105),7), isnull(count(1),0)
from tblstats s(nolock)
join tblDealer d(nolock)
on s.dealerid=d.id
where d.id=31
group by right(convert(varchar(25),s.stamp,105),7),d.name
order by 2 desc,3,1
this dealer had no clicks in april so this is what shows up:
joe blow 10-2004 567
joe blow 09-2004 269
joe blow 08-2004 66
joe blow 07-2004 30
joe blow 06-2004 8
joe blow 05-2004 5
joe blow 03-2004 9
View 1 Replies
View Related
Oct 2, 2000
I have complex VB code that loads millions of records into a SQL 7 database. I see my tempdb slowly growing until system runs out of disk space.
What are typical programming bugs that would cause tempdb to fill up,
and how can I identify the offending statements through profiler?
Any help greatly appreciated!
View 1 Replies
View Related
Dec 28, 2006
What is the best way to fix issues with your log files in TempDB when you start to see them causing error msgs?
Thansk for your time.
View 2 Replies
View Related
Aug 2, 2001
We have a stored procedure that uses temp tables and must gather a lot of data. When we stress test this stored procedure, the tempdb transaction log fills up.
We tried using "Select Into" for our tables. That caused us not to write to the transaction log but it caused problems because it locked up sysobjects.
Is there some other way not to write to the transaction log?
View 1 Replies
View Related
Aug 13, 2002
I have a database that I am splitting the data using odd account numbers and even account numbers. The odd acct numbers in one database and the even in the other database.
This database is very large. The problem is when I run the delete statements
it is going to fill up the log files. Can I turn on the "Simple" mode on the database while I am deleteing the data. Will this cause a problem? Then can I turn back on the 'Full' mode when I have finished?
Has anyone ever done this and so how did it work. Or better yet is it possible?
Thanks,
Dianne
View 2 Replies
View Related
Feb 26, 2007
Hello,
I am new to SQL Server and learning lots very quickly! I am experienced at building databases in Access and using VBA in Access and Excel.
I have a time series of 1440 records that may have some gaps in it. I need to check the time series for gaps and then fill these or reject the time series.
The criteria for accepting and rejecting is a user defined number of time steps from 1 to 10. For example, if the user sets the maximum gap as 5 time steps and a gap has 5 or less then I simply want to lineraly interpolate betwen the two timesteps bounding the gap. If the gap is 6 time steps then I will reject the timeseries.
I have searched the BOL and MSDN for SQL Server and think there must be a solution using the PredictTimeSeries in DMX, but not quite sure if I can do this. I may be better off simply passing through the time series as a recordset and processing as I would have done in Access...(I am reluctant to do this as I have of the order 100 * 5 * 365 time series and growng by 100 each day and fear it will take quite some time...)
Can anyone help me by pointing me in the right direction please?
Unless there is a way of using PredictTimeSeries on its own, I think the solution is:
Identify if a record is the a valid one or part of a gap (ie missing values).
Identify the longest gap and reject or process data on this value.
Identify if a record preceedes or succeeds a gap.
For each gap fill it using a linear interpolation.
Thanks,
Alan.
View 3 Replies
View Related
Oct 8, 2007
Hello,
In my application I am using Identity columns. When some rows are deleted from table, This identity values are not filling the gap. I mean My current identity is 5. That means 1 to 5 rows sequentially i inserted. If I am deleting 3rd and 4th rows, next identity will still continue with 6. So is there any method to fill the gap between rows
View 2 Replies
View Related
Jul 25, 2007
hi all!
I have 2 instances that communicate via service broker.
The conversations are only one way from initiator server1 db to target server2 db.
I also reuse dialog id's in BEGIN DIALOG @dlgId
i save @dlgId from the first run into a table and then retreive it for each message send
since the messages are constant i don't close the dialog at the target for each message.
i'm just wodering why do both sys.transmission_queue and sys.conversation_endpoints get a row
for each message i send but the transmission_status in sys.transmission_queue is emtpy.
also each conversation_handle and conversation_id is different for each row and
only one row in each sys table has the same conversation_handle as my saved @dlgId.
just wondering what is going on.
this code is done on the initiator
DECLARE @dlgId UNIQUEIDENTIFIER
-- each database has one dialog id
SELECT @dlgId = DialogId
FROM dbo.Dialogs
WHERE DbId = DB_ID()
-- Begin the dialog, either with existing or new Id
BEGIN DIALOG @dlgId
FROM SERVICE [//DataSender] -- service on initiator server
TO SERVICE '//DataWriter', -- service on target server
-- Target's Service Broker Id
'83382A22-2830-4B25-B067-15AAC255EB03'
ON CONTRACT [//Contract1]
WITH ENCRYPTION = OFF;
-- Send data
;SEND ON CONVERSATION @dlgId
MESSAGE TYPE [//Message1] (@msg)
Thanx,
Mladen
View 7 Replies
View Related
Feb 8, 2008
Hi All,
i have 50 tables.
M trying to fill the table in dataset using a loop.
no roblem for first 25 tables ,
but at 26th table it gives the error "Input string was not in a correct format.Couldn't store <value> in "column_name" Column. Expected type is UInt32.
column type is varchar(50)
changed it to TEXT ....but nothing happened.
its taking numericals but no characters.
Debugged one by one...
at 26th table....
adapter.fill(dataset)
throws exception
Please help me.
regards,
Amit.
View 6 Replies
View Related
Sep 4, 2007
I am having an issue with the transaction growing uncontrolled and filling up the disk. I suspect that transactions are structured incorrectly between the web application that is monitoring a queue and the SQL that is executing the WAITFOR RECEIVE. This method is receiving large binary objects, so thats the reason for the arguments to the reader. Also, even though its not the suggested way, we commit everytime through to prevent the queue from disabling (which it was doing when we would ROLLBACK - we don't really care if the message is bad, we just want to log it and wait for the next one).
The basic structure is this, which is executed on a separate thread. Am I missing something that could be causing transactions to get into a state where the log grows uncontrollably? Is there a problem with the loop? Should I be doing a ROLLBACK when there is nothing to receive (this is a low volume queue, so it may not receive a message for a few minutes or more)? If so, where should I be doing this?
private void MonitorUpdateQueue()
{
const string _sqlEndDialog = @"END CONVERSATION @conversationHandle";
const string _errorMessageType = @"http://schemas.microsoft.com/SQL/ServiceBroker/Error";
const string _endDialogMessageType = @"http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog";
using (_ssbConnection)
{
if (_ssbConnection == null) _ssbConnection = new SqlConnection();
using (_monitorQueueCommand =
new SqlCommand("asp_ProcessMessage", _ssbConnection))
{
_monitorQueueCommand.CommandType = CommandType.StoredProcedure;
_monitorQueueCommand.CommandTimeout = 0;
while (true)
{
SqlDataReader reader = null;
Guid conversationHandle = Guid.Empty;
Byte[] payloadBytes = { 0 };
try
{
if (_ssbConnection.State == ConnectionState.Closed)
{
_ssbConnection.ConnectionString = _ssbConnectionString;
_ssbConnection.Open();
}
Byte[] latestFullUpdate = null;
_monitorQueueCommand.Transaction = _ssbConnection.BeginTransaction(IsolationLevel.Serializable);
if (_monitorQueueCommand.Transaction != null)
{
reader = _monitorQueueCommand.ExecuteReader(CommandBehavior.SequentialAccess);
if (reader != null)
{
XmlDocument updateMessage = new XmlDocument();
while (reader.Read())
{
conversationHandle = reader.GetGuid(0);
string messageType = reader.GetString(1);
payloadBytes = reader.GetSqlBytes(2).Value;
if (messageType == _endDialogMessageType || messageType == _errorMessageType)
{
SqlCommand cmdEndDialog = new SqlCommand(_sqlEndDialog, _ssbConnection, _monitorQueueCommand.Transaction);
cmdEndDialog.Parameters.AddWithValue("@conversationHandle",
conversationHandle);
cmdEndDialog.ExecuteNonQuery();
}
else
{
if (payloadBytes.Length > 0)
{
ProcessUpdateQueue(updateMessage);
}
}
}
reader.Close();
}
_monitorQueueCommand.Transaction.Commit();
}
}
catch (Exception ex)
{
if (_monitorQueueCommand.Transaction != null && _monitorQueueCommand.Transaction.Connection != null)
{
// Dequeue the bad message and ends the conversation
SqlCommand cmdQuarantineMessage = new SqlCommand("usp_FailMessage", _ssbConnection, _monitorQueueCommand.Transaction);
cmdQuarantineMessage.CommandType = CommandType.StoredProcedure;
cmdQuarantineMessage.ExecuteNonQuery();
if (reader != null && !reader.IsClosed) reader.Close();
if (_monitorQueueCommand.Transaction != null) _monitorQueueCommand.Transaction.Commit();
}
log.Error("Error monitoring queue.", ex);
}
finally
{
if (reader != null && !reader.IsClosed) reader.Close();
if (_monitorQueueCommand.Transaction != null)
{
_monitorQueueCommand.Transaction = null;
}
}
}
}
}
}
The stored procedure that is monitoring looks like this:
CREATE PROCEDURE [dbo].[asp_ProcessMessage]
AS
BEGIN
WAITFOR ( RECEIVE TOP ( 1 ) conversation_handle, message_type_name, message_body
FROM [MyQueue] ) ;
END
View 3 Replies
View Related
Feb 9, 2006
hie
can i use sql server 2005 along with asp.net 1.1 as my front end ?
any idea of doing this ?
View 1 Replies
View Related
May 8, 2006
hi friends,
i look forward an answer that solves my problem.
iam trying too populate a DropDown list . here is the codings. Previously it was working. suddenly,
it s generating error.
strConnectionString = "Provider = SQLOLEDB;Integrated Security=False; User ID=sa;Password=;Data Source=GIREESH-AC720F7;Initial Catalog=NorthWind"
in page_load event
dim sql as string
sql = "select AthleteNameKey from athletes"
result_adap = DbAccess.ExecuteAdaP(sql)
result_adap.Fill(result_ds, "athletes")
cboAthleteName.DataSource = "athletes"
cboAthleteName.DataTextField = "AthleteNameKey"
cboAthleteName.DataValueField = "AthleteNameKey"
cboAthleteName.DataBind()
Public Function ExecuteAdaP(ByVal sqls As String) As OleDbDataAdapter
'Dim ds As New OleDbDataAdapter
Dim da As New OleDbDataAdapter(sqls, strConnectionString)
'da.Fill(ds)
Return da
End Function
View 1 Replies
View Related
Jun 9, 2004
Hello all
I have shifted my vb/access database to vb/mysql and i have one form in my project in which i want to display all the records in the database in the list box . But while doing this i m getting the error " variable uses an automation type not supported in visual basic " . Moreover, it was working in Vb/access .
here is the code
Dim sql As String
intCountSW_ID = 0
sql = "select SW_IDEN, SW_NAME, SW_DELETE,SW_LEFTDATE from SV_SOCIALWORKER order by SW_NAME"
If rs.State = 1 Then rs.Close
Set connString = New ADODB.Connection
connString.CursorLocation = adUseClient
connString.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=;" _
& "DATABASE=shrivatsa;" _
& "UID=root;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
connString.Open
rs.ActiveConnection = connString
rs.CursorLocation = adUseClient
rs.Open sql, connString, adOpenStatic, adLockOptimistic
intCountSW_ID = rs.RecordCount
If intCountSW_ID > 0 Then
rs.MoveFirst
While Not rs.EOF
/* here comes the error on the below code
If rs("SW_DELETE") = 0 And IsNull(rs("SW_LEFTDATE"))
*/
Then
lstCaseName.AddItem rs("SW_IDEN") & " " & rs("SW_NAME")
End If
rs.MoveNext
Wend
rs.Close
End If
mfuncFillList = intCountSW_ID
View 1 Replies
View Related
Dec 13, 2007
Hi,
I've been having problems with my tempdb filling up, and causing all databases on the server to stop functioning properly. I've been removing alot of data lately (millions of rows), and I think this is the reason why my tempdb log is going thru an unusual load.
Whats the best way to make sure the tempdb doesnt fill up causing me major problems? I had temporarily turned off backups while I was having a new HD put in. Am I right in thinking that when a DB is backed up, the tempdb log is reduced in size? Should maintaining a daily backup solution help keep things under control ?
Thanks very much for any tips!
mike123
View 4 Replies
View Related
Jul 20, 2005
I have a table that has a int field that contains unique nubers.if I need to insert 4000 or so new records into this table using a SQLcommand how would I be able to fill this field with the next availablenumber?This will be a manual procedure done maybe once a year so the nextnumber will be known ahaed of time. but the insert command need toincrement this number by one everytime it puts a new row in.
View 2 Replies
View Related
Nov 15, 2006
Hi,
I always get a "ConstraintException" error when trying, at beginning of application, to run following statement (within "Form1_Load" routine called by "this->Load" EventHandler):
"this->TauxTaxeTableAdapter->FillByPays(this->TauxTaxeDataSet->TauxTaxe,Cur_GrdView_SlPays);"
Also curiously if, while application is still running, I invoke again that same statement by means of a pushbutton clickevent, everything is running smootly without error... Looks to me that it is bugging only when running the first time...
Within Dataset, I tried to see what constraint could give me such trouble. Here is the only constraint I could find:
"this->Constraints->Add((gcnew System::Data::UniqueConstraint(L"Constraint1", gcnew cli::array< System::Data::DataColumn^ >(2) {this->columnPays, this->columnProvince_Etat}, true)));"
I then tried to find within "TauxTaxe" table if there could be any trace of records where "Pays" and "Province_Etat" columns would show any null value as well as any duplicate key values but there wasn't any...
Any place I should start to look for? BTW, I'm using a SQL Express database.
Thanks for your help,
Stéphane
Here is the detailed error log I got:
System.Data.ConstraintException: Impossible d'activer les contraintes. Une ou plusieurs lignes contiennent des valeurs qui violent les contraintes de type non null, unique ou de clé externe.
à System.Data.DataSet.FailedEnableConstraints()
à System.Data.DataSet.EnableConstraints()
à System.Data.DataSet.set_EnforceConstraints(Boolean value)
à System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
à System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
à System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
à System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
à Test_ADO.DS_TauxTaxeTableAdapters.TA_TauxTaxe.FillByPays(TauxTaxeDataTable dataTable, String Pays) dans d:projetvisual c++ 2005projets c++cli est_adods_tauxtaxe.h:ligne 1247
à Test_ADO.Form1.Sel_Pays_NewSel(Object sender, EventArgs e) dans d:projetvisual c++ 2005projets c++cli est_adoform1.h:ligne 1887
à System.Windows.Forms.RadioButton.OnCheckedChanged(EventArgs e)
à System.Windows.Forms.RadioButton.set_Checked(Boolean value)
à Test_ADO.Form1.Init_Form1() dans d:projetvisual c++ 2005projets c++cli est_adoform1.h:ligne 1480
à Test_ADO.Form1.Form1_Load(Object sender, EventArgs e) dans d:projetvisual c++ 2005projets c++cli est_adoform1.h:ligne 1446
à System.Windows.Forms.Form.OnLoad(EventArgs e)
à System.Windows.Forms.Form.OnCreateControl()
à System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
à System.Windows.Forms.Control.CreateControl()
à System.Windows.Forms.Control.WmShowWindow(Message& m)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
à System.Windows.Forms.ContainerControl.WndProc(Message& m)
à System.Windows.Forms.Form.WmShowWindow(Message& m)
à System.Windows.Forms.Form.WndProc(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Finally, SQL Statement for "TA_TauxTaxe::FillByPays" is the following:
SELECT Pays, Province_Etat, Taxe1_Appl, Taxe1_Dsc, Taxe1_Taux, Taxe2_Appl, Taxe2_Dsc, Taxe2_Taux
FROM TauxTaxe
WHERE (Pays = @Pays)
In debug mode, I double-checked and could verify that @Pays didn't have any null value but a valid string value at time "Fill" routine was invoked. Any clue?
View 3 Replies
View Related
Oct 31, 2007
Hi,
I have the following table :
Code Block
Create table #Customers (custid int,name nvarchar(20),age int, st_code int,
citycode int, internalid int,type int,oldcustid int)
Insert into #Customers values(101,'Aron',23,1,1,12,1,0);
Insert into #Customers values(102,'Cathy',28,1,1,13,1,0);
Insert into #Customers values(103,'Zarog',33,1,1,14,1,0);
Insert into #Customers values(104,'Michale',25,1,2,12,1,0);
Insert into #Customers values(105,'Linda',43,1,2,13,1,0);
Insert into #Customers values(106,'Burt',53,1,2,14,1,0);
If you observe, the rows are unique based on the internalid per st_code,per city_code
Problem :
Now the user inserts another row but this time he passes only the following :
Insert into #Customer values(120,'AronNew',null,1,1,12,null,null) -
Note he doesnt pass the age or the type
I want that when he passes this row, i match up this row with the existing row based on st_code,citycode and internalid and then update the new row with the missing values(only columns with null) that were there in the existing row
OUTPUT
120,'AronNew',23,1,1,12,1,0
How could I write the query for this?
thanks.
View 5 Replies
View Related
May 21, 2007
I have implemented a caching strategy using the sqlcachedependency and sql server 2005 backend using the broker service.This works fine and well when i am connecting to the SQL Server 2005 under service account that is in the role db_owner. In a production enivironment i am reluctant to do this so i created another service account that only has execute permissions on the stored procedures.When i use this limited service account for my ASP.net web application, the broker service does not send any messages to the web app to invalid the cache. When checking the event log and SQL profiler i get errors all relating to the user not having access to the SqlQueryNotificationService queue. So i did a lot of googling and tried running the grant scripts below with no luck using this limited service account. Keep in mind everything works fine if i use an account with db_owner priviledges. These are the grants i have tried based on numerious articles GRANT CREATE PROCEDURE TO three_d_ss_loginGRANT CREATE QUEUE TO three_d_ss_loginGRANT CREATE SERVICE TO three_d_ss_loginGRANT SUBSCRIBE QUERY NOTIFICATIONS TO three_d_ss_loginGRANT RECEIVE ON QueryNotificationErrorsQueue TO three_d_ss_loginGRANT REFERENCES ON CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification] TO three_d_ss_login These are the grants i have tried that does not work GRANT SEND ON SERVICE::SqlQueryNotificationService TO three_d_ss_loginGRANT RECEIVE on SqlQueryNotificationService_DefaultQueue to three_d_ss_loginCan some one suggest what i need to do to get sqlcacheddependencies to work with a sql2005 backend under a limited priviledged service account? ThanksJim
View 4 Replies
View Related