TSQL, 261(削除) 261 (削除ここまで) 236 bytes
One line query - no looping
DECLARE @i INT =5;
WITH C as(SELECT top(@i*2-1)number z,abs(@i+~number)f
FROM master..spt_values WHERE'P'=type)SELECT
top(@i*2-1)space(abs(z-@i+1)*2f*2)+v+STUFF+v+stuff(reverse(v),1,3,'')FROM(SELECT
zSELECT*,(SELECTtop((@i-abs(@i-z-1))f)char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio
TSQL, 261 bytes
One line query - no looping
DECLARE @i INT =5;
WITH C as(SELECT top(@i*2-1)number z
FROM master..spt_values WHERE'P'=type)SELECT
top(@i*2-1)space(abs(z-@i+1)*2)+v+STUFF(reverse(v),1,3,'')FROM(SELECT
z,(SELECTtop((@i-abs(@i-z-1)))char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio
TSQL, (削除) 261 (削除ここまで) 236 bytes
DECLARE @i INT =5;
WITH C as(SELECT number z,abs(@i+~number)f
FROM spt_values WHERE'P'=type)SELECT
top(@i*2-1)space(f*2)+v+stuff(reverse(v),1,3,'')FROM(SELECT*,(SELECTtop(@i-f)char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d
#TSQL, 261 bytes
TSQL, 261 bytes
One line query - no looping
DECLARE @i INT =5;
WITH C as(SELECT top(@i*2-1)number z
FROM master..spt_values WHERE'P'=type)SELECT
top(@i*2-1)space(abs(z-@i+1)*2)+v+STUFF(reverse(v),1,3,'')FROM(SELECT
z,(SELECT top((@i-abs(@i-z-1)))char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio
#TSQL, 261 bytes
One line query - no looping
DECLARE @i INT =5;
WITH C as(SELECT top(@i*2-1)number z
FROM master..spt_values WHERE'P'=type)SELECT
top(@i*2-1)space(abs(z-@i+1)*2)+v+STUFF(reverse(v),1,3,'')FROM(SELECT
z,(SELECT top((@i-abs(@i-z-1)))char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio
TSQL, 261 bytes
One line query - no looping
DECLARE @i INT =5;
WITH C as(SELECT top(@i*2-1)number z
FROM master..spt_values WHERE'P'=type)SELECT
top(@i*2-1)space(abs(z-@i+1)*2)+v+STUFF(reverse(v),1,3,'')FROM(SELECT
z,(SELECT top((@i-abs(@i-z-1)))char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio
#TSQL, 254261 bytes
One line query - no looping
DECLARE @i INT=4;INT =5;
WITH C as(SELECT top(@i/2*2+1@i*2-1)number z
FROM master..spt_valuesWHERE'P'=type)SELECT
top(@i*2-1)space(abs(@i/2-z-@i+1)*2)+v+STUFF(reverse(v),1,3,'')FROM(SELECT
z,(SELECT top((@i/2-abs(@i/2-z-1)+1))char(z+6565+z)+' 'FROM
c c
for xml path(''),type).value('.','varchar(52)')v FROM c)Dd
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio
#TSQL, 254 bytes
One line - no looping
DECLARE @i INT=4;
WITH C as(SELECT top(@i/2*2+1)number z
FROM master..spt_valuesWHERE'P'=type)SELECT
space(abs(@i/2-z)*2)+v+STUFF(reverse(v),1,3,'')FROM(SELECT
z,(SELECT top(@i/2-abs(@i/2-z)+1)char(z+65)+' 'FROM
c for xml path(''),type).value('.','varchar(52)')v FROM c)D
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio
#TSQL, 261 bytes
One line query - no looping
DECLARE @i INT =5;
WITH C as(SELECT top(@i*2-1)number z
FROM master..spt_valuesWHERE'P'=type)SELECT
top(@i*2-1)space(abs(z-@i+1)*2)+v+STUFF(reverse(v),1,3,'')FROM(SELECT
z,(SELECT top((@i-abs(@i-z-1)))char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d
Unfortunately the fiddle eats up the spaces at the start of the output lines. Spaces will be there if executed in SQL Server management studio