Databases :: Bad SQL Query Or Tables Not Indexed Properly?
Sep 29, 2010will bad SQL query or tables not indexed properly cause any problem when we execute it? or it may just take more time to execute??
View 3 Replieswill bad SQL query or tables not indexed properly cause any problem when we execute it? or it may just take more time to execute??
View 3 RepliesI have an C# ASP application I am writing that needs to have the capability to import a generated excel or a comma delineated sheet each day. A clerk will have this job each morning so it doesn't need to be automated. My problem in trying to understand the solution to this is that the 1 sheet contains loan information, including customer information all in the same sheet. I would like to send certain columns to update information in the loan table and send other information to update the customer table. I need it to create relationships when new loans appear in the spreadsheet.
View 1 RepliesA follow up question concerning the DAL layer part .. The first question about dealing with large objectsI have one table (PlacesTable) that is connected by like 6 other tables (1:Many and Many:Many relations)
In my DAL should I put a big query that join the 6 tables + the m:m reference tables (btw it produces multiple data that I don't need Please refer to my old question) and place all the data in it's specific object property or, should I use a single query for each table and create an object for each fetched table .. and finally send those to the UI ?If I wasn't clear enough please let me know what I further information do you need to know!
I am a biggner in SQL DB . but i started a complicated and painfull work in SQL SERVER 2008. the problem convert Oracle hierarchical query to SQL query. the query
SELECT DISTINCT
LEVEL LVL,
SCH.NSCHEDULE_SL,
SCH.NSCHEDULE_SL_FM,
SCH.CSHED_CNAME
FROM FA_SCHEDULES SCH
WHERE LEVEL = 1
AND NSCHEDULE_SL_FM IS NULL
AND NBRANCH_SL = 2
CONNECT BY PRIOR SCH.NSCHEDULE_SL_FM = SCH.NSCHEDULE_SL
AND NBRANCH_SL = 2
I am having 2 databases namely ach and cart and i am having tables namelt Register and Invoice i would like to add a field in to those 2 tables . Like if i enter a value like some ccyyxxyxyxa this should be saved in the 2 tables...
View 3 RepliesI have a C# problem I need to synchronize two MS Access tables from two different databases(two databases over a network) which is quite similar, I thought of using two different OleDbConnections and two DataAdapters to fill a Single DataSet and then manipulate the data in the DataSet, I think the source table (database with the primary data) should be loaded first (into the DataSet) then the secondary table from the remote database should subtract the existing records in the DataSet to get the difference then the difference should be Appended to the remote table, but I don't know how to remove the same records from the DataSet and to send the remaining records to the secondary database.
Here is some code I already have, but I don't know how to get this to work:
[Code]....
i need to join two tables in different databases, how it can be done??? and if i want to use sqldatasource control to bind results to some data-bound control how can I configure my sqldatasource control???
View 3 RepliesI've a problem in MySql.I need to retrieve data from two tables,in which one field is common in both the tables and I need to retrieve distinct data.But all I'm getting is this :
Id Name Initial
1 abc A
1 abc A
1 abc A
2 def B
2 def B
2 def B
How can I make it like this :
Id Name Initial
1 abc A
2 def B
3 ghi C
I am using mysql as my database.From one of my web pages I want to insert data to 4 tables.All the data should be inserted to these different tables on a single button click from the web page.How can I achieve this?Which is most reliable way to insert data to multiple tables on a single click event?
Will the sql operation with 4 'insert' statements separated by semicolon work for me?
I need to join two tables accross two different databases and return an ADO dataset.
ie: select * from database1.table1 a inner join database2.table2 b on
a.key=b.key where some_condition=true
My main problem is how to specify the SqlCommand parameters specifically the connection string for both databses. Is this possible?
I am having a hell of a time trying to figue out groupings on data tables with LINQ. I am using VB
I have two data tables. I'll define from Table Law = columns (ven_grp,comp_no,acct_unit,description,company)
Table Comps = columns(comp_parent,comp_struct1, comp_struct2, .... through comp_struct9 Now here is the SQL equivalent of what I need in LINQ
[Code]....
For reasons I won't get into I can't use SQL to do what I need to do. this is how far I got with LINQ
[Code]....
which works ok, but I can't for the life of me figure out how to group on the fields I need to and then dump the query results into datatable. I've looked at tons of examples on line and I just don't seem to get it or it does not work the way examples show. Both of my tables are defined as similar "Dim law = ds.tables(0).asenumerable()
We have some stored procedures in mysql which use temporary tables.For performace reasons we need to replace them and write alternate code.
View 1 RepliesThe query I used here is
SELECT top '"+lblCount.text+"' Company_Id, CompanyName, All_Countries,All_Industries,Employees,Revenue, Status FROM SN001CompanyTable where Client_Id=100 ORDER BY [Company_Id] DESC
but its not showing proper results..
In this lblCount contains the no of row to be displayed..
I need to insert/update data to 3 or more tables on a single button click.What is best method for achieving this?I am using mysql as my DB.
View 2 Replieshave a database and I've created a DBML Linq-to-SQL file to represent this database. I've created a new aspx page and dropped a linqdatasource and a formview control onto it. When I configure the linqdatasource it gives me the choice only to select * from one table...but I want to pull from multiple tables. e.g. I have tables like simple_person, simple_address, simple_phone, and I want to pull from all of them.
View 1 RepliesHow can I insert value in two tables by single sql query because if I'm using two sql query it gives problem me on binding data and connection. Like I have 2 table table 1, table 2 ... In table I'm only save id and name and in other table I'm saving id, time1, time2
View 1 RepliesI need to insert values from the frontend into a mysql table. I am using a 3 layer architecture. the below is the code that is written in my dataaccess layer. the query is not being executed.
public int Insert(List<EmployeeUInfo> objInsert)
{
try
{
DataTable dtInsertRow = new DataTable();
[Code]....
Trying to modify an existing gridview in an aspx to access a db2 table on an iseries server. The iseries seems to have problems with the parameter specified in the query as @parameter giving a @parameter does not exist in table error. When specifying the gridview in VS the wizard did not recognize that the @parameter was a parm and prompt for the control etc. where it could be found. Of course there is no problem when accessing a mssql server table. Can someone help me with how to connect properly to the iseries and how to pass a parm on my query?
View 1 Repliesi am developing a web site in Asp.Net using Visual Studio 2008.i want to know that how can i search a keyword that will be entered by the user, i want the key word should be searched in complete database(all the tables)using a single query.I am using sql database. how can the keyword be searched using like parameter...
View 1 RepliesAs the title sugests, I am missing a (basic?) concept as I teach myself asp.net, linq, and C#. It has been awhile since I've done anything object oriented, so I don't know how much that is impacting this gap in my understanding. Anyhow, here is what I am trying to do. I have three SQL Server tables: PERSON, POSITION, AREA. There is a 1 to many relationship between PERSON and POSITION, and a 1 to 1 relationship between POSITION and AREA. Given the following code I verify who the person is who has logged into the browser:
[Code]....
I want to be able to return all of the AREAs the person is able to access, based on the position they currently hold. I am able to easily do this in a SQL Server query, and I am sure I can do this with a SQL stored procedure once I pass the EMPLOYEE_ID to the procedure. However, I would rather do this in the page_load event, and load the returned results into gridview1 for the viewer. The issue I am running into is in building the LINQ query. When I try to build it, I can only get access to two of the three tables, depending on which table I select with db. Is it possible to access all three tables in the same query?
I want to do execute a LINQ query, and I have the name of the table to query stored in a variable:
string tableName = "SomeTable";
DataContext db = new DataContext();
var vResult = from t in db.tableName where t.Id = ....
I am trying to create an application in which there is a summary of outstanding payments.
One table is Table_Bills.
The other table stores records of Payments made and is called Table_Payments.
In summary i want to show 3 figures - each in separate one field datagridview with a data_source in separate data_adapter:
1) Ammount_Due 2) Amount_Paid 3) Balance.
The first two are no problem but the last is giving me a headache.
I tried this:
SELECT SUM(DHB_New_Jobtable.DayWage) - SUM(DHB_Payments.Ammount) AS Expr1
I am a little new to this concept so bear with me.1) I need to query atleast 35 tables using linq to sql(SQL server database) . I am not able to add all the database entities in Linq to sql classes?
2)(View Model issue) When I use List<Reportcollection> and also List<Receipt> to convert the result then its giving an error that "Cannot convert list<anonymous> to list<string>"
how can I display a linq query in a gridview that has data from multiple tables AND allow the user to edit some of the fields or delete the data from a single table?
I'd like to do this with either a linqdatasource or a linq query. I'm aware I can set the e.Result to the query on the selecting event. I've also been able to build a custom databound control for displaying the linq relations (parent.child).
However, I'm not sure how I can make this work with delete? I'm thinking I may need to handle the delete event with custom code.
can get two tables in only one query with LINQ to Entities
Code for example:
[Code]....