scene.org File Archive

File download

<root>­/­parties­/­2023­/­vccc23­/­christmas-diamonds/michal-wrobel_sqlserver_sql_vc3-2023.zip

File size:
142 620 bytes (139.28K)
File date:
2024-01-03 14:15:18
Download count:
all-time: 1

Preview

  • code.sql 163B
  • file_id.diz 994B
  • result.png 7.58K
  • source.png 26.99K
  • source_with_result.png 107.92K

file_id.diz

SQL oneliner

Author: Michal Wrobel
Category: Christmas Challenge
System:   Microsoft SQL Server 2005+
Language: SQL (Microsoft)
Len source code: 163
Len exe file:    -
Len code only:   -
Instructions:
Install SQL Server (can be free Express Edition version 2005 or newer), run SQL Server Management Studio,
connect to the server, choose "new query", paste the code, hit F5 to run.
Description:
We have two loops, one for rows and one for columns. Loop counters are named @1 and @2 respectively 
(number-only variable name is valid in SQL Server). Third variable, named @ (also valid name) is text
buffer for output. Goto instruction is rarely used in wild, but it is possible and valid. 
For each posotion we calculate whether to print * or space. It is possible to avoid spaces after 
several isnstructions, which saves some bytes.
Comments:
My solution is in SQL because SQL Server is what I use at work. Code is interpreted server-side so
there is no executable version.