Vinay Thakur


Blog Post

Cursor Dynamic SQL

Today was working on SQL Server cursor standard cursor deification would be like this: sqlcursor from (Azure Data Studio) ———————————————————————————————————————– — Declare a cursor for a Table or a View ‘TableOrViewName’ in schema ‘dbo’ DECLARE @ColumnName1 NVARCHAR(50), @ColumnName2 NVARCHAR(50) DECLARE db_cursor CURSOR FOR SELECT name FROM dbo.TableOrViewName OPEN db_cursor FETCH NEXT FROM db_cursor INTO @ColumnName1, @ColumnName2 WHILE @@FETCH_STATUS = 0...

2019-11-19

332 reads

Blog Post

Transaction log Information gathering

Here are the different ways to know the tlog file related information sys.dm_db_log_stats – Provide summary of tlog information SELECT * FROM sys.dm_db_log_stats(db_id()) sys.dm_db_log_info -DMV function for VLF information...

2019-11-14

88 reads

Blog Post

Smart Tlog Bkp

another great new feature for SQL Server 2017 is a smart backup with dmv sys.dm_db_log_space_usage this DMV provide log usage information using this we can plan to initiate the...

2019-11-05

16 reads

Blog Post

SQL Server 2019 GA

Yes, Finally SQL Server 2019 is Generally Available yesterday Nov 4th 2019. It has many great features great videos: https://channel9.msdn.com/Niners/dutchdatadude   https://cloudblogs.microsoft.com/sqlserver/2019/11/04/gain-intelligence-over-data-with-sql-server-2019-now-generally-available/ https://cloudblogs.microsoft.com/sqlserver/2019/11/04/sql-server-2019-is-now-generally-available/    

2019-11-05

83 reads

Blog Post

Back to school

Hey, I realize that future we need to know Database system, No SQL and Big Data. with that as things are moving to machine learning and AI system which...

2019-11-02

12 reads

Blog Post

Error 9002

This is very important error whenever you see this error it is clear that your database has “TLOG FILE FULL” and this could result into maintenance job  failed or...

2019-10-30

24 reads

Blogs

Big Queries, Big Money

By

I had been meaning to post this, so as I finished a piece that...

A New Word: Fardle-dun

By

fardle-din – n. a long-overdue argument that shakes up a relationship, burning wildly through...

Lukáš Karlovský: I got the green light from management and built Fabric specialization from scratch

By

The post Lukáš Karlovský: I got the green light from management and built Fabric...

Read the latest Blogs

Forums

Peer review SQL Central articles

By Srinivasarao Daruna

Hi, I would like to contribute to SQLServerCentral in peer reviews. As there are...

Getting ANY of the data

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Getting ANY of the data

Why Would You Do That?

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Why Would You Do That?

Visit the forum

Question of the Day

Getting ANY of the data

I have this data in two tables:

-- Beer table
BeerIDBeerNamebrewer
5Becks    Interbrew
6Fat Tire   New Belgium
7Mac n Jacks  Mac & Jack's Brewery
8Alaskan AmberAlaskan Brewing 
9Kirin        Kirin Brewing

-- Beercount table
BeerName      BottleCount
Becks         5
Fat Tire      1
Mac n Jacks   2
Alaskan Amber 4
NULL          7
Corona        2
Tsing Tao     4
Kirin         12
What is returned from this query?
SELECT *
FROM dbo.BeerCount AS bc
WHERE bc.BeerName=ANY
  (SELECT b2.BeerName FROM dbo.Beer AS b2);
 

See possible answers