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

Image may be NSFW.
Clik here to view.

Microsoft TechNet Wiki T-SQL Guru - Winners for October!!

The results for October's TechNet Guru competition have been posted!http://blogs.technet.com/b/wikininjas/archive/2013/11/17/technet-guru-awards-october-2013.aspx Congratulations to all our new Gurus...

View Article


Incorrect syntax

I try to run this queriyselect first_name, last_name, agefrom studentwhere student.age = (select max(student.age) from studentand student.student_type = 'Overseas Student');but i'm getting errorMsg...

View Article


T-SQL challenge

Hi,I have table called addr_history and address. The address table stores recent data and addr_history stores the history of the address. In the below query I need minimum create_operator and minimum...

View Article

TSQL Query

I have three tables #Factsource,#Fact and#DimSource#factSource and#fact are joined on(Rx_Identifier)#FactSource and#DimSource are joined on(Rx_Pres_No, Refill_no)I am loading the #Fact from#factSource...

View Article

Image may be NSFW.
Clik here to view.

November on TechNet: Calling All T-SQL Gurus - Enlighten Us!

"An influential teacher, or popular expert" Oh mighty reader, we need your enlightenment! Only YOU can show us... the TRUE WAY to code! Win the love and adoration of generations to come, by giving...

View Article


COUNT DISTINCT WITHIN WINDOW

Hi All,I am trying to get a distinct count within a window. For example:use tempdb; IF OBJECT_ID('T1', 'U') IS NOT NULL DROP TABLE T1; CREATE TABLE T1 ( ShipperID int primary key, OrderID int, PickID...

View Article

Pushing inserts into SQL server with C# ?

I want to insert about 5000 (typically, can be 10K+ at times) rows into SQL server at a time. My insert statements are generated by a C# program.  One way could be by simply generating a big string...

View Article

Accumulated field

Hello everybody.I have this table...

View Article


Parallel query plan returns different results every time that you run the...

I'm experiencing the problem where a parallel query plan is returning incorrect results on a multicore processor system.The problem is described in http://support.microsoft.com/kb/981502. Having tried...

View Article


Create a table valued function to get dates from a table and run a query

Hi All, Here is my requirement, I need to create a table valued function which basically runs the following query for the current date SELECT * FROM OPENQUERY([abc], 'select * from...

View Article

The maximum recursion 100 has been exhausted before statement completion

hi  following is the my table , data and stored procedure but when we execute my stored procedure as followsexec CountDownlineNode 'LDS'it does not show any record and it take infinite time in...

View Article

SQL Statement Troubles

OK, this should pretty easy, but I can't locate any examples of what I need to save my life!! Let's say I have data that looks like the table below. I am trying to count the number of DISTINCT...

View Article

how to convert the given date format

Take current date as 19/11/2013 to convert this date to YYYYMMDD and concatenate with  01 in place of 'DD'the given like 20131101 and subtract with the given date format to -1 and find out the last...

View Article


What is better in term of performance between these 4 queries

1 . Select * from table1 where table1.A in (1,2,3,4,5,6)2.  Select * from table1 where table1.A in (1,2,3) UNION ALL Select * from table1 where table1.A in (4,5,6)3.  Select A.* From (Select * from...

View Article

Testing a Query I have done de-fragmentation of Indexes.

Hey everyone,I'm a long time "lurker" on these forums and I need some help with some of my Queries. So I need to find out the average percentage of fragmentation on each Index. So I ran this...

View Article


Need to select multiple rows and return comma delmited value

I have a select statement which returns one seqno value when one type value is entered. I need multiple seqno's returned when multiple type values are entered.The statement is: select seqno from...

View Article

Duplicating ID

Hi ,I have two tables .Test1 table goes well with inserting data into table  .But I want to  Test2   Test_ID should references to Test1(ID).Can anyone please  help .How to join this query.CREATE TABLE...

View Article


Exec storedprocedure results don't have header info?

I have requirement to send the weekly database size (day by day size) in the form of email attachment?i created sp with below :GO ALTER procedure [dbo].[GETDBSIZEWeeklyReport] as set nocount on  select...

View Article

SQL Server Possible Order By Bug

Hello, We noticed some odd behaviour of the ORDER BY clause inside the following pieces of code: -- Batch 1:DECLARE@iINT = 0SELECT@i= @i+a  FROM (SELECT 1aUNION ALLSELECT 2 UNIONALLSELECT 3)x  ORDERBY...

View Article

Image may be NSFW.
Clik here to view.

Stored Procedure Not Working

I can't figure out why this stored procedure is not doing what I expect it to do. I have taken the screen shots of the table, data, procedure and the results.I'm expecting this to return 3 rows: 1.2.3,...

View Article
Browsing all 23857 articles
Browse latest View live


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