T-SQL (Transact Structured Query Language) is the extension of SQL functionality supported by Sybase ASE and Microsoft SQL Server.

learn more… | top users | synonyms (2)

0
votes
1answer
22 views

Need help on a T-SQL XPath query

I'm hoping somebody can help me solve a syntax problem with a TSQL xpath query. Given the following xml: <emails> <email></email> <email></email> ...
-2
votes
0answers
10 views

Add Linear Regression column in dataset SQL Server 2008 for SSRS trendline

My problem is I am not able to figure out how to calculate the trendline value for my scatter plot report in SSRS. I'm sure there is a way to do this. My user wants a scatter plot chart with ...
1
vote
3answers
31 views

Comparing substrings in same table

I need to run a query that will give me the list of all entries in one column that is NOT LIKE any of the entries in another column, i.e.: SELECT DISTINCT columnA FROM tableA WHERE columnA NOT LIKE ...
0
votes
1answer
11 views

Xml Shredding .Value Singleton

I am querying an Xml column in SQL Server 2012. When moving the path to the .value method the results are not returning all the element instances! ,c.value('(*/*/Visitors/Visitor/@Name)[1]', ...
0
votes
2answers
29 views

'an expression of non boolean type specified' in CASE WHEN

Given this T-SQL code: SELECT CASE WHEN ( Cast (CASE WHEN Isnull(bpe.new, 0) = 0 AND Isnull(bpe.regular, 0) = 0 ...
2
votes
2answers
25 views

Finding groups of clustered data points

I have a table which records events: create table #events ( intRowId int identity(1,1), intItemId int, intUserId int, datEvent datetime) It's a big table with many millions of rows, ...
2
votes
3answers
62 views

IF statement in SQL WHERE clause

Is it possible to pass in a value to a stored procedure to tell it whether or not to append an OR statement to a SQL SELECT statement? I've tried something like so but it is not valid: SELECT ...
3
votes
4answers
67 views

How to get Previous Value for Null Values

I have the Below Data in my Table. | Id | FeeModeId |Name | Amount| --------------------------------------------- | 1 | NULL | NULL | 20 | | 2 | 1 ...
2
votes
1answer
55 views

T-SQL: Get top n records by column

Struggling with what's probably a very simple problem. I have a query like this: ;WITH rankedData AS ( -- a big, complex subquery) SELECT UserId, AttributeId, ItemId ...
2
votes
4answers
40 views

Instead of NULL how do I show `0` in result with SELECT statement sql?

I have one stored procedure which is giving me an output (I stored it in a #temp table) and that output I'm passing to another scalar function. Instead of NULL how do I show 0 in result with ...
0
votes
1answer
22 views

TRIGGER show two row affected T-SQL

I would like to get data only once. How to do it? for example only from first action table myTABLE1 ( NAME, SURNAME, USERNAME, USERDATE ) first action to MyTABLE1 INSERT INTO MyTABLE1 SELECT ...
0
votes
2answers
26 views

T-SQL - Best way to select rows that corresponds to a category and default category if the category is not configured

I have a table of configuration data that can be associated to a Recipe (category to be more generic). Like this: Recipes: ID Name 1 Default 2 A 3 B Configuration Data ID equipment ParentID ...
0
votes
3answers
29 views

Is there a way to set variables in a Select statement that can be used in the same statements WHERE clause?

I'm looking for a way to set a variable in a Select statement so it can be later used in the where clause. Here is an example: SELECT DateDiff(d,Time_Stamp,GetDate()) as Var1 FROM Report Where Var1 ...
0
votes
3answers
24 views

Should this T-SQL be done using a UNION

Using the table below (call it TableA), I need to create an SQL statement that selects two sets of data and combines them together. First, I need to select those rows where Status = 1 and the ...
1
vote
1answer
22 views

How to only return in certain increments of days

I'm trying to return every 14 days starting from 12/31/2010 to 12/31/2011, but this statement doesn't seem to work SELECT DISTINCT Convert(varchar,Month(Time_Stamp)) + '/' + ...

1 2 3 4 5 1355
15 30 50 per page