Hi Friends,Tell me How to delete records from multiple tables by using a single query.
View Complete Post
I have a single select query with multiple table joins in it.
I want to retrieve the Most Recent records from one of the table among the tables in multiple joins.
(select t1.col1, t2.col2 , t3.col3, t4.col4, t4.Add_Date,t5.col5,
from dbo.table1 t1
left outer join dbo.table2 t2 on t1.col1=t2.col2
left outer join
(select col3 from dbo.table3 where condition1="expr") as t3
left outer join dbo.table4 t4 on t1.col1=t4.col4 order by t4.Add_Date
left outer join dbo.table5 t5 on t1.col1=t5.col5 )
Problem is that, I am not able to use the "Order by" for a particular table.
DELETE Users, meet, tour FROM Users, meet, tour WHERE Users.uid=meet.desg AND meet.desg=tour.desg AND Users.uid='CCC';
i have try this command to to delete record from three table
i want to delete all the record of uid from user ,tour and meet at once.
Users table having a key uid which is common to all table.
in table Users, uid is primery key
and meet table having desg and tour having desg common field value
i.e. Users.uid=meet.desg=tour.desg are same desg in both table is foreign key
so how could i delete uid from Users table ,desg from tour and meet at once and all the record from these 3 tables
im not that familar with xml but im stumple across the problem that i cannot save 1: M relationships when i have to save more than column in the a child table. else could use csv and i could save off one column. But when i have save more than one column
in ths second, third...etc i cannot think of anything else than xml.. but im familar with xmal and xpath, xquery all that.
So is there a popular atechnique that the developers use to save records into multple table than use of xml?
i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset
like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid as a compact data and combination of 3 tables from d single dataset.....
can some1 help me please.....
In a shared environment you typically don't have access to delete your database, and recreate it for fresh installs of your product.
I managed to find these scripts which should help you clean out your database.
Use at your own risk.
--Delete All KeysDECLARE @Sql NVARCHAR(500) DECLARE @Cursor CURSORSET @Cursor = CURSOR FAST_FORWARD FORSELECT DISTINCT sql = 'ALTER TABLE [' + tc2.TABLE_NAME + '] DROP [' + rc1.CONSTRAINT_NAME + ']'FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc1LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc2 ON tc2.CONSTRAINT_NAME =rc1.CONSTRAINT_NAMEOPEN @Cursor FETCH search multiple words into textbox and populate all records in gridview related those keywords I have a textbox and a gridview which is bound to a tablewhat I want to achieve is a solution where lets say there are two records - e.g. "1. Book and 2. Red", i want a user to type in those words and the gridview shows the results as followed;1. Book2. RedI have set up the sql data source and everything and my like operator is this...LIKE '%' + @record + '%'how can I solve this problem?
I have a textbox and a gridview which is bound to a table
what I want to achieve is a solution where lets say there are two records - e.g. "1. Book and 2. Red", i want a user to type in those words and the gridview shows the results as followed;
I have set up the sql data source and everything and my like operator is this...
LIKE '%' + @record + '%'
how can I solve this problem?
I have 2 tables in SqlServer 2008.
Table1: T1id, SomeData
Table2: T2id, T1id, SomeData
I am using DataAdapter.FillSchema to create shema of tables in DataSet. I created DataRelation on columns T1id in both tables.
Now when i try to Update Sql Database T1id in Table2 remains 0 and not the value of T1id in Table1.
I can successfully update Sql Database if i fill DataSet with records first (Using DataAdapter.Fill), but that's not what i want to do. I don't need "old" records in my dataset. I want to use dataset just to store all imputs from user until the proccess is done and then insert all those records "at the same time".
I think i'm getting it wrong with ForeignKeyConstraints, maybe UpdateRule is not set to cascade, i just don't know.
I have been trying to work this out for 6 days now and i'm about to break something on half.
Can someone please guide me to right direction, maybe post some sample, anything.... please!
My old post regarding this:
How to update Sql Server related tables from Dataset(SchemaFill)
SqlDataAdapter.Update related tables