I have a performance problem with a stored procedure. Because when I check my benchmark’s result I realized that “MatchxxxReferencesByIds” has ‘240.25’ ms Average LastElapsedTimeInSecond. How can I improve my procedure? Answer Based on the execution plan of the stored procedure, …
Tag: sql-server
How to delete records from a table if they don’t meet a condition in another table
I have two tables, company and company_name. company contains the columns: company_id(primary key) and company_name, while company_name contains the columns: company_id(foreign key from company table),…
Performance for Avg & Max in SQL
I want to decrease the query execution time for the following query. This query is taking around 1 min 20 secs for about 2k records. Numbers of records in table: 1348474 Number of records processed through where query: 25000 Number of records returned: 2152 I tried removing the AVG & MAX columns and it lo…
SQL – Calculating third column from previous two
I have just started SQL and have some difficulties in terms of thinking in this language. I have now a task where I need to create a new column in a table with values from previous columns. This …
Transfering Data with VBA(Excel) to SQL Server but avoiding duplicate column?
My main objective is to transfer some data from excel to SQL server while using vba but in the process I would like to detect and avoid transferring some duplicate month columns. This is what i have …
SQL – Search ‘Address’ Where Contains string parameter
I have a stored procedure which locates the specific address. Fields City Province Zip code Records City : Manila, Makati, Cebu City, Kawit Province : NCR, NCR, CEBU, CAVITE Zip Code: 1111, 2222, …
Reformatting SQL output
I have data that looks like this Name XX YY alpha 10 77 beta 10 90 alpha 20 72 beta 20 91 alpha 30 75 beta 30 94 alpha 40 76 beta 40 95 If I use select * from scores order by Name, XX I will …
Extracting Numeric values from a column (VARCHAR) based on a preqrequisite
I currently access a table view from SQL server and write custom SQL query to retrieve/filter/create custom column as per my need before exporting. Now in that view one of the columns have text value as following Now all I want is to create a custom column which would extract all the numeric values and –…
Getting the personal contact details of an employee
I want to get the Email, Phone and Mobile number of each employee. The ContactDetailsType contains the Label which is email,phone,fax… and ContactDetails contains the ContactDetailsTypeId (the ID of ContactDetailsType) and the Info having the value of the phone number (for example). I tried the followin…
How to join two tables in one view?
I am trying to create a view where I can see the items that have been planned to be shipped and have not been shipped, and the items have have been shipped but were not planned to. In order to do …