Well, it depends on what you consider Pure sql I came up with the following solution. It is written exclusively in T-SQL, but uses a dynamically built query.
-- Using variables just for better readability. DECLARE @Name NVARCHAR(4000) DECLARE @Schema NVARCHAR(4000) DECLARE @Query NVARCHAR(4000) -- Get the relevant data SET @Schema = QUOTENAME(OBJECT_SCHEMA_NAME(613577224)) SET @Name = QUOTENAME(OBJECT_NAME(613577224)) -- Build query taking into consideration the schema and possible poor object naming SET @Query = 'SELECT COUNT(*) FROM ' + @Schema + '.' + @Name + '' -- execute it. EXEC(@Query)
EDIT
The changes address possible erroneous cases described in the comments.
I set out the variables because this is a convenient approach for me. Greetings.
Oybek source share