I have a table with the following columns:
ID INTEGEDR,
Name VARCHAR(32),
Surname VARCHAR(32),
GroupID INTEGER,
SubGroupOneID INTEGER,
SubGroupTwoID INTEGER
How can I create a rule/default/check which update SubGroupOneID &
SubGroupTwoID columns when GroupID for example is equal 15 on
MSSQL2000.
It is imposible to make changes on client, so I need to check
inserted/updated value of GroupID column and automaticly update
SubGroupOneID & SubGroupTwoID columns.
I use ODBC driver to perform SQLServer commands from C/C++ application.
An "INSERT INTO <table> (<column>) VALUES (NULL)" command has a random behavior in a SQL2000 Server running on WindowsXP.
The <column> in this command has 2 definitions about the NULL value :
- the NULL is accepted in the table definition, with <column> ut_oui_non NULL".
- the NULL is rejected in the type definition, with EXEC sp_addtype ut_oui_non, 'char(1)', 'NOT NULL' and a rule to check values with '0' or '1'
1/ The column definition in any explorer show the NULL from table deffinition
2/ The "INSERT INTO" is completed in SQL Query tool, used on Windows2000 and WindowsXP computers, connected to the same SQL2000 server.
3/ The "INSERT INTO" is completed in the application, running on Windows2000 with an ODBC driver to the same SQL2000 server.
4/ The "INSERT INTO" is rejected in the application, running on WindowsXP witjh an ODBC driver to the same SQL2000 server. The error 513 means that INSERT VALUES conflicts with previous rule. So only the type definition seems to be used.
But :
5/ This is a random error, and some INSERT with the same values in this column are completed.
6/ This random error seems to be discarded by using the "Use NULLs, paddings and warnings ANSI" checkbox in the ODBC driver user source configuration.
This checkbox is only use for enforcing the ANSI syntax in SQL commands, and has no known effect on type checking.
Do you know about any conflict of column NULL value between a type definition and a table definition ?
I have a table in a database that keeps getting duplicate records added to it. Is there a way to set a rule so that if someone tries to add a duplicate record for that field, it will stop the record from going in?
I know creating an index would be the proper way to do this but:
1. The application does not belong to us. 2. Duplicates already exist in the table for the database.
Basically I am trying to do the most without making alot of changes to the database.
Hi, I have a database which saves data about bus links. I want to provide a information to passenger about price of their journay. The price depends on three factors: starting busstop, ending busstop and type of ticket (full, part - for students and old people, ...). So I created a table with three foreign key constraints (two for busstops and one for type). When the busstop is deleted or type of ticket I want all data connected with it to be deleted automatically. I wanted to use cascade deleting. But I receive a following exception: Introducing FOREIGN KEY constraint 'FK_TicketPrices_BusStops1' on table 'TicketPrices' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. How can I achieve my task? Why should it cause cycles or multiple cascade paths?
I want to update two tables in one page. So I created two FormView bound on two SqlDataSource controls, and I create a Update button on the bottom of page. And I writen some codes as below: btnUpate_Click(object sender, EventArgs e){ sqlDataSource1.Update(); sqlDateSource2.Update();} But, the records haven't updated. In SqlDataSource2_Updating() function, I found all the parameters is null. So, how to modify my code to do it.
i have been trying to create new columns in a tabinvoice details using row data from another table and additional input from another form. Problem is i get no sql errors m database conection is ok usually works but doesn't write any new columns or values to the tblinvoicedetails here is the code i am using i hope someone ca tell me where i am going wrong.
Hi I came across something like 3-4-5 rule while going through datamining book....but couldn't get from where that rule has been generalized and how it really works....
Hello. Could anyone tell me why it is not possible to create a foreign key on two columns those references on 2 columns in another table? Those 2 columns have each a unique constraint.
I have: CREATE TABLE T_PK (ID1 INT CONSTRAINT CHK_UNIQUE1 UNIQUE,ID2 INT CONSTRAINT CHK_UNIQUE2 UNIQUE)
hi, in the front end i have two fields one is dropdown list another is checboxlist say dropdownlist consist of title name and checkbox list consists of sub title name.on selecting title name from dropdownlist i will be getting respective title name in checkboxlist. here when i select checkboxlist(suppose if there are 6 items in checkboxlist n if i select only 3)then my databse column should generate one dropdownlist selected item and 3 checkboxlist selected item.
Eg: if dropdownlist contains( title1,title2,title3) and checkboxlist contains(chk1,chk2,chk3,chk4,chk5,chk6). if i select title1 from dropdownlist i will be geeting 6 item in checkbox list) if i select only 3 items of checkbox list. then i should be able to create column name by title1,chk1,chk2,chk3
Am a fresher and I got a scenario like i have to take create script of some tables of a database in sql server and I generated script to them and i have to add four new columns to the script and have to delete 2 columns from existing script for multiple tables at a time. It will take more time to do them individually.Is there any way to do this at a time and with in short period of time????
I have a table that I cannot allow a computed field to exist on (due to a 3rd party software), so I am thinking I could create a view with a computed field that is persistent, is that possible?
the syntax below will not work, I am not even sure if this is possible, but if it can work, that would be great.
I am wanting to get the sum of jetfoot1, 2 & 3 and have the total added up as "total"
create view ViewSumReport as select JETFOOT1,JETFOOT2,JETFOOT3,(JETFOOT1+JETFOOT2+JETFOOT3)as [total] persisted from dbo.fielddata GO
I always know that the ReportPackId and SupplierPartyIdentifier will be identical for all rows because of the Where condition, and therefore I want all AdditionalPartyIdentifiers to be in columns instead of a new row. Is this possible?
I need to create table in sql server 2005 database, I have plenty of columns. Well I know how to create them manually. but does any body know or tried before to create columns automatically, or through some batch process. I have column names already typed in TXT file (comma delimited).
Hi,I have made the code to update more than 2 columns..It is a bad syntax, could someone help me improve my syntax?Code: command.CommandText = "UPDATE Items SET (Quantityavailable,numtaken) = (Quantityavailable - @qty,numtaken + @qty) WHERE productID=@productID"; command.Parameters.Add("@qty", TextBox1.Text); command.Parameters.Add("@productID", labid.Text); command.ExecuteNonQuery(); The idea is to update Quantityavailable column by taking away the @qty value, and update numtaken column by adding the @qty column.It says there is a syntax error near '('. Thanks if someone can help,Jon
How do I update all of the columns I want to update in one swipe?I can do them 1 at a time like this, but how do I update them ALL to = 0? Update Booth_Visitors_Data Set Hygienic_Actuators = 0 Where Trade_Show_Id = 34NFPA_ActuatorsCG5_CJ5Conveyor_Rail_AdjusterEX510FEP_TubingKQG_fittingsControlNetEtherNet_IPISE_ZSESVVQCWashdown_ProductsInstrumentationFittingsGTAPOEM_GTAPEmailed
assume my Table's Columns looks like below1 , Annie, History, pass, null 2 , Colin, Math , Pass, null7 , Annie, History, Fail, 111 , Colin, Math , Fail, 2When Delete 7 , Annie, History, Fail, 111 , Colin, Math , Fail, 2using the last column to check which row is reference with itso when delete Row 7 which reference with 1 , Annie, History, pass, null when delete Row 11 which reference with2 , Colin, Math , Pass, nullif I gooing to delete the row of No7 the result would be1 , Annie, History, Fail, null 2 , Colin, Math , Pass, 0 11 , Colin, Math , Pass, 0if I going to delete the row of No11 the result would be1 , Annie, History, pass, null2 , Colin, Math , Pass, null7 , Annie, History, Fail, 1I think the simply way to explan iswhen you delete a row of data , first find out which row is reference with it and then update the row which reference with it can you teach me how to do it ? wirte this request in Code or useing SQL Script?thank you
Hi I have to update the incidents table. The initiator and initdept are two corresponding columns whoes value I have to get from another table Employee where (initiator means Empname and initdept means title) if i just do
select Empname,title from employee it gives me correct output while select initiator,initdept from incidents
It gives the initiator correct but instead of giving the initdept it gives output as initaiator the out put is given below
initiator initdept Jeff C. Taylor Jeff C. Taylor Randy S. Jonas Randy S. Jonas Mike lewis Mike lewis
it should give the out put like
initiator initdept Jeff C. Taylor Software Engg Randy S. Jonas Tester
I hope you got my question! now I hav to update incidents table such that it should give initiator as well as its corrosponding initdept
How can I setup the dbs in sql server so that when I change the data in one table the changes will cascade down to the tables in my other dbs. Therefore, one database would hold a primary key table. If I had 15 other dbs, then I could somehow link them so the data changed in the primary key table of the 1st database would cascade down to the other dbs.
Hello, I will explain myself further. I want to make my table in such a way that no two colums have the same value for example: Row 1 - Column 1 = "cool" Row 1 - Column 3 = 91 Row 3 - Column 1 = "cool" Row 3 - Column 3 = 91
I dont care about one column having duplicate values, I want to protect against Column 1 and 3 having the same values on other rows. Is this possible to do in sql server?
I have a very large SQL Server table and want to pull all 50 columns that are in a certain row because something in that row has invalid varchar and is causing runtime errors. It is row 9054378701 and I am not sure how to create a query to pull that specific row and all 50 columns.
Hi, I have a sproc that returns somevalues and everything is working fine... and in my reports i am assigning the header data (in a detail column) based on the some feilds in the sproc... and there around 20 feilds that i want to show... but at a given time i am pretty sure that there wont be more than 10 fields that will have data.
So is it possible that show only the columns that have data in it and sometimes if there is less that 5 - 6 fields.. i want to realign the widths in those tables..
I have a stored procedure that inserts values into five columns of atable. I need another stored procedure that will allow the user to passone or more of those parameters and update only the column for the datathat was passed. In other words, the update may only have one or two ofthe parameters that was originally provided in the insert. Therefore, Ido not want to update the columns that did not change. What is theproper way to handle this situation?
I need to create an SSIS package that updates columns in a table from columns in another database where the keys match. What's the best way to do this?
I want to update only the Columns which are different to the values of my update-Statement.
One of the problems is an update trigger , which is fired on all update statements. I want the trigger to be fired only when there are real changes. Of course i can retrospectively check if there was a real, but i can't devide the real updatet colums from the non changed values. I know there is a statement like RowsUpdated but it doesn't work that way. It indicates also the non changed columns. To lock the row pessimistic read and compare the contents before update is also no option for me.
Is there any command to perform this in a smart way? Or should it be suggested for the next version of SQL-Server like "UPDATE CHANGES MY_TABLENAME SET MY_COLUMN= ... "