Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 176 characters in body
Source Link
t-clausen.dk
  • 3.8k
  • 13
  • 17

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

Fiddle Fiddle

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

Fiddle

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

Fiddle

Commonmark migration
Source Link

#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

Fiddle

#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

Fiddle

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

Fiddle

Post Undeleted by t-clausen.dk
added 11 characters in body
Source Link
t-clausen.dk
  • 3.8k
  • 13
  • 17

#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

Fiddle Fiddle

#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

Fiddle

#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

Fiddle

Post Deleted by t-clausen.dk
Source Link
t-clausen.dk
  • 3.8k
  • 13
  • 17
Loading

AltStyle によって変換されたページ (->オリジナル) /