4,586 questions with Transact-SQL-related tags

Sort by: Updated
1 answer One of the answers was accepted by the question author.

Trying to show a row total as percentage of the whole

I've looked at several examples of using the windowing functions to achieve what I am aiming for and as far as I can tell, I have my syntax correct according to those. However, I'm still getting an error : Column…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,586 questions
asked 2020-08-18T02:39:46.867+00:00
Nick Ryan (NZ) 121 Reputation points
commented 2020-08-19T03:05:37.337+00:00
Nick Ryan (NZ) 121 Reputation points
1 answer

How to Reset DENSE_RANK for new group

Hi All, How to reset DENSE_RANK for new set DDL and sample data population, start drop table if exists #t select * into #t from (select 1 as ID, 'a1' as address,'p1' as phone) p insert into #t select 1, 'a1', 'p2' union select…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,586 questions
asked 2020-08-18T13:59:35.78+00:00
Papillon28 86 Reputation points
answered 2020-08-18T23:11:40.333+00:00
Jingyang Li 5,891 Reputation points
2 answers One of the answers was accepted by the question author.

sql if value is null not equal does not work

I have the below query, but the AND pd.FROMLOC <> 'DMS' does not work if the column has {null} is there a workaround? SELECT pd.wavekey, pd.orderkey, o.externorderkey, pd.pickdetailkey, pd.status, pd.fromloc, pd.loc, pd.sku, pd.qty,…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,586 questions
asked 2020-08-18T15:27:27.96+00:00
jim brown 271 Reputation points
commented 2020-08-18T19:31:35.217+00:00
Yitzhak Khabinsky 25,646 Reputation points
2 answers One of the answers was accepted by the question author.

Display current hour Production

CREATE TABLE dbo.RAWTable(Time_Stamp datetime , Date date , Shift_Id varchar(5) , Line_Code varchar(10) , Machine_Code varchar(10) , Variant_Code varchar(20) , Machine_Status varchar(30) , OK_Parts int , NOK_Parts int , …

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,150 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,586 questions
asked 2020-08-17T12:15:33.477+00:00
Rakesh Ponnala 21 Reputation points
commented 2020-08-18T12:12:48.63+00:00
Rakesh Ponnala 21 Reputation points
1 answer One of the answers was accepted by the question author.

Select statements included within a function cannot return data to a client. FUNCTION SQL SERVER

CREATE FUNCTION Testing(@d1 DATE,@d2 DATE,@nd VARCHAR(MAX)) RETURNS int WITH EXECUTE AS CALLER AS BEGIN ;with AllDates AS ( SELECT @d1 AS DateOf UNION ALL SELECT DateAdd(day,1,DateOf) FROM AllDates WHERE DateOf<@d2 ) select…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,586 questions
asked 2020-08-18T11:20:45.207+00:00
TAII EL MEHDI 21 Reputation points
accepted 2020-08-18T12:11:33.46+00:00
TAII EL MEHDI 21 Reputation points
2 answers

how do i solve this?

/*Create College table */ Use SigmaUniversity; GO Create table College ( CollegeCode int not null, CollegeName nvarchar(50) not null, DeanFirstName nvarchar(50) not null, DeanLastName nvarchar(50) not null, DeanEmail nvarchar(50) not null, …

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,586 questions
asked 2020-06-04T17:09:29.033+00:00
Nur Rohadatul Aisy Bte Rozmin 1 Reputation point
answered 2020-06-05T20:26:54.647+00:00
Poy Siraprapa 1 Reputation point