Skip to content Skip to sidebar Skip to footer
Showing posts with the label Tsql

Yearweek On Sql Server

How can I extract the year and week combination from a date in SQL Server using T-SQL and have it m… Read more Yearweek On Sql Server

Sql Server : How To Use An Aggregate Function Like Max In A Where Clause

I want get the maximum value for this record. Please help me: SELECT rest.field1 FROM masterta… Read more Sql Server : How To Use An Aggregate Function Like Max In A Where Clause

Using Fts Query, Can You Find All Entries Contains 'abc'

I am new to Full Text Search, how do I perform a search using Contains instead of using like in the… Read more Using Fts Query, Can You Find All Entries Contains 'abc'

Select Records From A Table Where All Other Records With Same Foreign Key Have A Certain Value

I have a the following table ItemStatus ---------- id item_id status I want to select all item_ids… Read more Select Records From A Table Where All Other Records With Same Foreign Key Have A Certain Value

How To Reorder A Sql Table

I have a table that looks like this: RecNo | TaskDesc | SeqNumber 1 | test | 1 2 | tes… Read more How To Reorder A Sql Table

Fill Missing Dates In A Date-sequenced In Sql Using Tally Table

I have a table in database with numbers of tenants, each tenant lists a record of their sales per d… Read more Fill Missing Dates In A Date-sequenced In Sql Using Tally Table

Calculate Work Time From Shift And Break Table

I am using SQL Server 2008. I have two table Shift and Break with following data: The shifts will b… Read more Calculate Work Time From Shift And Break Table

How To Get Id Of Last Inserted Row By Qsqlquery.lastinsertid() From Sql Server?

How can I get ID of last inserted row from SQL Server by PyQt4.QtSql module? Now I'm using SQL … Read more How To Get Id Of Last Inserted Row By Qsqlquery.lastinsertid() From Sql Server?

Merging Two Databases

I have two distinct mssql databases with identical schemas but different data on one system. I want… Read more Merging Two Databases

Dynamic Row Range When Calculating Moving Sum/average Using Window Functions (sql Server)

I'm currently working on a sample script which allows me to calculate the sum of the previous t… Read more Dynamic Row Range When Calculating Moving Sum/average Using Window Functions (sql Server)

Return Zero If Value Less Than Zero

Is it possible to return zero if a value is less than zero without using a case statement? e.g. Max… Read more Return Zero If Value Less Than Zero

Select Top N Dynamically With N From The Same Select Statement

I have a procedure that tries to insert samples in a table for each Agent, the # of samples for eac… Read more Select Top N Dynamically With N From The Same Select Statement

The Difference Between Each Row Value - Sum Error

My main query was solved at the following post TSQL - Get the difference between each row value I h… Read more The Difference Between Each Row Value - Sum Error

Tsql - Excluding The Rows That Matches With Temp Table

I need a help with SQL SELECT query. I have [Details] sql table below. I want to select rows that … Read more Tsql - Excluding The Rows That Matches With Temp Table

T-sql - Group By With Like - Is This Possible?

Is there a way to include a LIKE expression in a GROUP BY query? For example: SELECT Count(*) F… Read more T-sql - Group By With Like - Is This Possible?

Sql Server Stored Procedures: Do They Queue Up?

I should probably be able to find an answer to this but my Google-fu is weak today. When I have th… Read more Sql Server Stored Procedures: Do They Queue Up?