Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

How to find which query taking more cpu

Hi,How to find which query taking more CPUat a particular point of time .Chhers,

View Article


Remote Debugger failed in SS08

Hi I  am trying to remotely debug a sproc(from my machine). My login is set as a sysadmin. The following are the error messages i get.===================================Failed to start...

View Article


Most efficient way to query two tables for latest date

I have two large tables (order and invoices) each with about 35mill rows of data in them.  I am capture the latest date between the two tables and looking for the most efficent way to do this.  I am...

View Article

Indexing a table with 5 million records

Hi Experts,I'm developer and new to SQL server. Can anyone assist with me below query,We have a database table (SQL 2005 )with 5 million records, now if we add an index to a column (integer datatype)...

View Article

How to update an ID using a stored procedure in table #2

Environment: Win7 and SQL server 2008 R@Tools: SQL management tool 2008 R2T-SQL code - works fine- :CREATE TABLE employees ( id char(9), employee_number int not null, employee_name varchar(50) not...

View Article


UNIQUE constraint vs checking before INSERT

I have a SQL server table RealEstate with columns - Id, Property, Property_Value. This table has about 5-10 million rows and can increase even more in the future. I want to insert a row only if a...

View Article

Populate other column value based on previous row value using t-sql

Hi All,I have one table with 6 columns, let say ID1, ID2,status, EnteredDate,NewValue, Old Value. Where ID1 is the primary key field ID1       ID2       status             EnteredDate        NewValue...

View Article

How to write if else condition in stored procedure

Hi All,I have a code below in asp.net but i dont want to write this code in asp.net instead of this i want to write this in STPRED PROCEDURE.I am very much new to SP.Can u please help     I have a...

View Article


Increment a value inside stored procedure using while loop

Declare @a nt        ,@b nvarchar(6) SET @A = (SELECT MIN(A) FROM #DataToload) while @A is not null beginSet @B = (select MIN(B) FROM #DataToload)   while @B is not null         beginSelect * from...

View Article


Return ONLY first record

If I run this:Select*From security_hist where item='CUSIP' or item ='SEDOL'and GVKEY = '006066'I get 84,780 records returned.  If I run this:Select*From security_hist where(item='sedol' or item...

View Article

Create a copy of active database using T-SQL.

I have a requirement to create a copy of existing active (currently in use) database through code.I need to copy all objects which include tables, stored procs, triggers, functions, foreign keys,...

View Article

Help with T-SQL query

I have 3 hierarchical tables. [Parent] ->[Child1]->[Child2]I have [Xref] table which stores the documents associated with these three tables. In the [Xref] table, the column “TypeID” defines to...

View Article

Weekly Aggregation based on everyday date

Hi All,i have a table with 3 columns. Id , MeasureDate,Measure. Here   Id +MeasureDate as primary key.  In this table i want add a column Avg.  if i am running today 2/12/2014,2/5/2014,01/29/2014 and...

View Article


Image may be NSFW.
Clik here to view.

Issue with getting consumer with phone number for primary and secondary...

Hi Team,I am facing issue in getting a SQL Query:Here are my input tablesRequirement is to get all the primary consumer and their second consumers for an account with their phone numbersThis is the...

View Article

Find duplicates from different tables

I need to write a  sql query to   find out in which table holds the duplicate data.Duplicate : AAA company should be present(mapped) only once with XXX Partner. If it is repeated then would be...

View Article


The first update of the words in a text field

Hi Friends ;I want to The first update of the words in a text field ;FIELD = 'JANUARY SERVICE FEE'I want to only update first words using variableI can already do follow code but I want to do using...

View Article

Setting date format for the entire SQL Server installation - SQL Server 2008...

Hi,I need to safeguard the behaviour of SQL codes that inserting into SQL tables with some date columns. For this purpose, I need to change the date format for the SQL instance and not using CONVERT...

View Article


Image may be NSFW.
Clik here to view.

Very Bad perfromnce with high stress on Tempdb

Hello ,below is the execution plan for a query rapidly increase the Tempdb and has very slow performance,appreciate your suggestion to enhance this query (any data is available upon request) 

View Article

Getting error while adding HTML mail body

Hi, Am getting the error message while trying to add mail part in the below query. Help me to getthe result as HTML mail  The below one is a part of the original queryselect...

View Article

Image may be NSFW.
Clik here to view.

Problem with Contains - missing records

Hi,  I have created a full-text catalog for my table tDoc, but when I search records with contains,  I dont get all records. I search for 16949, and with LIKE, I get all 5, but with CONTAINS I only...

View Article
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>