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

SQl Server 2008 Performance Issue for Count(distinct()) and SUM() functions....

Hi Guys, The below one is my query. It's taking 12 seconds for the execution process. The count(distinct()) and SUM() functions are taking long time for execution. I tried it after create the...

View Article


strange parallel repartition streams behaviour

I have an execution plan in which an index scan is being performed on a non clustered index, this is a parallel operations and the rows are being split across six threads, as the data is distributed...

View Article


how to exclude unwanted data

Environment: SQL server 2005 and Win 7Tools: Management studio 2008 R2Question: I have 381 records of which two are unwanted and let us call it Query A.  Whereas, Query B has an outcome, which...

View Article

Do index intermediate levels reflect the delete changes immediately, or after...

Hello everyone,I have  a question.---------------Script---------------------------------------use AdventureWorks;goselect * into testfrom sales.SalesOrderDetail (nolock)goalter table test add primary...

View Article

SQL JOINS causing too much overhead

I am running this query, I believe my SQL statement is causing to much overhead and causing the 'System.OutOfMemoryException'. Please advice what I could do instead of performing this complex lookup...

View Article


Stored Procedure Executes, no row inserted!

SQL2008.I've been running some asp code that calls a stored procedure to insert (simple insert) a row into a table for some time.  Now, I need to make some changes to that file (adding some other SQL...

View Article

Open Query Timing out

I have an SQL job that uses openquery on a linked server and successfully transfers a table of about 30 million records and it takes about 30 minutes.I want to make sure all the rows copied...

View Article

xp_cmdshell returns error on command that runs in command prompt

I am trying to invoke an IMP SPSS production job from an sql script:EXEC xp_cmdshell 'stats T:\LFS2013\April\SPSS\Load_File.spj -production'but get the error:'stats' is not recognized as an internal or...

View Article


Getting records with special characters

Hi,I have a table1 - JOBS with column JobID and JobTitle. Table2 - Character with columnname Spl_char which contains the special characters other than letters (a-z) adn digits (0-9).I want to take out...

View Article


View the Dependencies of a Table: T-SQL code does not work

View the Dependencies of a Table in MSDN shows  alternative methods of getting this information: SSMS and T-SQL code. However, none of sys.sql_expression_dependencies,  sys.dm_sql_referencing_entities...

View Article

Concatenation in where clause

I have 2 tables and each table has say 1 column with thousands of rows.create table #t1 (id varchar (2) ) create table #t2 (id varchar (2) ) insert into #t1 values('01') insert into #t1 values('2')...

View Article

Parameters with sql

    Hello      i need to insert some values in parameters but how to assign values using case conditions, sum etc... i need to make separate blocks to set values? thanx//parameters@PE_VALOR_R...

View Article

sql -Join To get all Records

Hi Experts ,I am working on SQL-2008 I have Table One and Table Two ..I need to Join then In Such a Way to Get Table Three.. I tried Left,Right and Full Join But Did not Get Desire Result .. help me On...

View Article


Computed column vs trigger -- Performance question.

Hello, I have a customer table with the full information, about 20 columns of data, and I need to get a numeric value according to complex combination of 10 of those columns using CASE. I would like to...

View Article

%% Operator?

I found the following in the stored procedure, sp_addextendedproperty:EXEC %%ExtendedPropertySet().AddValue(Name = @name, Value = @value, Level0type = @level0type, Level0name = @level0name, Level1type...

View Article


Weird problem with the client

Hi everybody,I am trying to help the client with the strange problem. Instead of UPDATE command that he is supposed to be running according to the code in the application, he is running INSERT which is...

View Article

Query from multiple CTE's

Can I do something like this DECLARE @vals TABLE    (        tblid INT IDENTITY(1, 1),        val1 NVARCHAR(40),        val2 NVARCHAR(40)     ); WITH MyCTE1 AS (  SELECT top 10.... )WITH MyCTE2 AS (...

View Article


how to count number of left and right child in binary tree

i have two table like1.mastertabmid   email           ref.id      position  1     a@a.com       0          admin  2     b@b.com       1              L  3     C@c.com       1              R  4...

View Article

Hierarchical Child Records with Multiple Parents

Hello, In my limited experience I have used a cte to write simple hierarchical result sets but this one is a bit more complicated for me. My child data records have a primary parent record, a secondary...

View Article

Lock a row after SELECT and release after UPDATE

Hi All,Here’s what I’m trying to achieve. DDL -IF OBJECT_ID(N'FirstTab', N'U') IS NOT NULL DROP TABLE FirstTab; GO CREATE TABLE FirstTab (Id INT IDENTITY(1,1) PRIMARY KEY , StartVal INT,EndVal INT)...

View Article
Browsing all 23857 articles
Browse latest View live


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