1. SQL / Говнокод #13156

    −162

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    RIGHT(
      CAST( LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2) AS BIT)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2) AS BIT))) +LTRIM(STR(CAST(TRIP_NO&1 AS BIT))) AS VARCHAR ),
        
    len(
    
    CAST( LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2) AS BIT)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2) AS BIT)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2) AS BIT))) +LTRIM(STR(CAST(TRIP_NO&1 AS BIT))) AS VARCHAR )
    )
    -
    cast(
    CHARINDEX('1',
    CAST(
    LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2*2) as bit)))+
    LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2) as bit)))
    ..................................................................................................................................................................................
              +    2*t02.bin
              +    4*t03.bin
              +    8*t04.bin
              +   16*t05.bin
              +   32*t06.bin
              +   64*t07.bin
              +  128*t08.bin
              +  256*t09.bin
              +  512*t10.bin
              + 1024*t11.bin
              + 2048*t12.bin
              + 4096*t13.bin
              + 8192*t14.bin
              +16384*t15.bin
              +32768*t16.bin
             ) AS n_10
           , (
              CAST(t16.bin AS CHAR(1))
             +CAST(t15.bin AS CHAR(1))
             +CAST(t14.bin AS CHAR(1))
             +CAST(t13.bin AS CHAR(1))
             +CAST(t12.bin AS CHAR(1))
             +CAST(t11.bin AS CHAR(1))
             +CAST(t10.bin AS CHAR(1))
             +CAST(t09.bin AS CHAR(1))
             +CAST(t08.bin AS CHAR(1))
             +CAST(t07.bin AS CHAR(1))
             +CAST(t06.bin AS CHAR(1))
             +CAST(t05.bin AS CHAR(1))
             +CAST(t04.bin AS CHAR(1))
    ......................................................................................................................................................................
    100000000000000*        (trip_no/2/2/2/2/2         /2/2/2/2/2/2/2/2/2%2)+
      10000000000000*      (trip_no/2/2/2/2/2/2       /2/2/2/2/2/2/2%2)+
      1000000000000*     (trip_no/2/2/2/2/2/2/      2/2/2/2/2/2%2)+
      100000000000*     (trip_no  /2/2/2/2/2/      2/2/2/2/2/2%2)+
       10000000000*   (trip_no    /2/2/2/2/2/     2/2/2/2/2%2)+
       1000000000*   (trip_no      /2/2/2/2/     2/2/2/2/2%2)+
        100000000*  (trip_no        /2/2/2/2    /2/2/2/2%2)+
        10000000*  (trip_no          /2/2/2/    2/2/2/2%2)+
         1000000* (trip_no           /2/2/2/   2/2/2%2)+
          100000* (trip_no            /2/2/2/  2/2%2)+
           10000* (trip_no              /2/2/  2/2%2)+
             1000*(trip_no               /2/2/ 2%2)+
              100*(trip_no                  /2/2%2)+
               10*(trip_no                     /2%2)+
                  1*(trip_no                       %2)
    ..................................................................................................................................................................
    		CASE WHEN trip_no/32768>0 		THEN CAST((trip_no & 32768)/32768	AS varchar)ELSE '' END +
    		CASE WHEN trip_no/16384>0 		THEN CAST((trip_no & 16384)/16384   AS varchar)ELSE '' END +
    		CASE WHEN trip_no/8192>0 		THEN CAST((trip_no & 8192)/8192		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/4096>0 		THEN CAST((trip_no & 4096)/4096		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/2048>0 		THEN CAST((trip_no & 2048)/2048		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/1024>0 		THEN CAST((trip_no & 1024)/1024		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/512>0 		THEN CAST((trip_no & 512)/512		AS varchar)ELSE ''END+
    ..............................................................................................................................
    --И еще с десяток таких же

    Еще выдержки из вариатов с sql-ex.
    Задача:Предполагая, что не существует номера рейса большего 65535, вывести номер рейса и его представление в двоичной системе счисления (без ведущих нулей)

    Как всегда обращаю внимание, что выложенны только части вариантов решения и они не могут быть поданы за свои кем-либо.

    crastinus, 11 Июня 2013

    Комментарии (31)
  2. SQL / Говнокод #13151

    −166

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    SELECT DISTINCT d.ageing as predicateid,
    		CONCAT(
    			TRIM(
    				TRIM(TRAILING "года" FROM 
    					TRIM(TRAILING "лет" FROM 
    						REPLACE(
    							REPLACE(
    								REPLACE(
    									REPLACE(
    										REPLACE(
    											REPLACE(
    												REPLACE(d.ageing, "не более ", "lte"), 
    											"не менее ","gte"),
    										"более ", "gt"),
    									"от ", "gt"),
    								"до ", "lt"),
    							"около ", "ab"), 
    						"менее ", "lt")
    					)
    				)
    			), 
    		"ag")  as nodecode, ...

    DIX315, 11 Июня 2013

    Комментарии (5)
  3. SQL / Говнокод #13130

    −160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    select model,
    case when c1>='0' and c1<='9' then cast(c1 as integer) else 0 end +
    case when c2>='0' and c2<='9' then cast(c2 as integer) else 0 end +
    case when c3>='0' and c3<='9' then cast(c3 as integer) else 0 end +
    case when c4>='0' and c4<='9' then cast(c4 as integer) else 0 end +
    case when c5>='0' and c5<='9' then cast(c5 as integer) else 0 end +
    case when c6>='0' and c6<='9' then cast(c6 as integer) else 0 end +
    case when c7>='0' and c7<='9' then cast(c7 as integer) else 0 end +
    case when c8>='0' and c8<='9' then cast(c8 as integer) else 0 end +
    case when c9>='0' and c9<='9' then cast(c9 as integer) else 0 end +
    case when c10>='0' and c10<='9' then cast(c10 as integer) else 0 end +
    case when c11>='0' and c11<='9' then cast(c11 as integer) else 0 end +
    case when c12>='0' and c12<='9' then cast(c12 as integer) else 0 end +
    case when c13>='0' and c13<='9' then cast(c13 as integer) else 0 end +
    case when c14>='0' and c14<='9' then cast(c14 as integer) else 0 end +
    case when c15>='0' and c15<='9' then cast(c15 as integer) else 0 end +
    case when c16>='0' and c16<='9' then cast(c16 as integer) else 0 end +
    case when c17>='0' and c17<='9' then cast(c17 as integer) else 0 end +
    case when c18>='0' and c18<='9' then cast(c18 as integer) else 0 end +
    case when c19>='0' and c19<='9' then cast(c19 as integer) else 0 end +
    case when c20>='0' and c20<='9' then cast(c20 as integer) else 0 end +
    case when c21>='0' and c21<='9' then cast(c21 as integer) else 0 end +
    case when c22>='0' and c22<='9' then cast(c22 as integer) else 0 end +
    case when c23>='0' and c23<='9' then cast(c23 as integer) else 0 end +
    case when c24>='0' and c24<='9' then cast(c24 as integer) else 0 end +
    case when c25>='0' and c25<='9' then cast(c25 as integer) else 0 end +
    case when c26>='0' and c26<='9' then cast(c26 as integer) else 0 end +
    case when c27>='0' and c27<='9' then cast(c27 as integer) else 0 end +
    case when c28>='0' and c28<='9' then cast(c28 as integer) else 0 end +
    case when c29>='0' and c29<='9' then cast(c29 as integer) else 0 end +
    case when c30>='0' and c30<='9' then cast(c30 as integer) else 0 end +
    case when c21>='0' and c31<='9' then cast(c31 as integer) else 0 end +
    case when c22>='0' and c32<='9' then cast(c32 as integer) else 0 end +
    case when c23>='0' and c33<='9' then cast(c33 as integer) else 0 end +
    case when c34>='0' and c34<='9' then cast(c34 as integer) else 0 end +
    case when c35>='0' and c35<='9' then cast(c35 as integer) else 0 end +
    case when c36>='0' and c36<='9' then cast(c36 as integer) else 0 end +
    case when c37>='0' and c37<='9' then cast(c37 as integer) else 0 end +
    case when c38>='0' and c38<='9' then cast(c38 as integer) else 0 end +
    case when c39>='0' and c39<='9' then cast(c39 as integer) else 0 end +
    case when c40>='0' and c40<='9' then cast(c40 as integer) else 0 end +
    case when c41>='0' and c41<='9' then cast(c41 as integer) else 0 end +
    case when c42>='0' and c42<='9' then cast(c42 as integer) else 0 end +
    case when c43>='0' and c43<='9' then cast(c43 as integer) else 0 end +
    case when c44>='0' and c44<='9' then cast(c44 as integer) else 0 end +
    case when c45>='0' and c45<='9' then cast(c45 as integer) else 0 end +
    case when c46>='0' and c46<='9' then cast(c46 as integer) else 0 end +
    case when c47>='0' and c47<='9' then cast(c47 as integer) else 0 end +
    case when c48>='0' and c48<='9' then cast(c48 as integer) else 0 end +
    case when c49>='0' and c49<='9' then cast(c49 as integer) else 0 end +
    case when c50>='0' and c50<='9' then cast(c50 as integer) else 0 end from(
    select model,
    coalesce(substring(m,1,1),'0') as c1,
    coalesce(substring(m,2,1),'0') as c2,
    coalesce(substring(m,3,1),'0') as c3,
    coalesce(substring(m,4,1),'0') as c4,
    coalesce(substring(m,5,1),'0') as c5,
    coalesce(substring(m,6,1),'0') as c6,
    coalesce(substring(m,7,1),'0') as c7,
    coalesce(substring(m,8,1),'0') as c8,
    coalesce(substring(m,9,1),'0') as c9,
    coalesce(substring(m,10,1),'0') as c10,
    coalesce(substring(m,11,1),'0') as c11,
    coalesce(substring(m,12,1),'0') as c12,
    coalesce(substring(m,13,1),'0') as c13,
    coalesce(substring(m,14,1),'0') as c14,
    coalesce(substring(m,15,1),'0') as c15,
    coalesce(substring(m,16,1),'0') as c16,
    coalesce(substring(m,17,1),'0') as c17,
    coalesce(substring(m,18,1),'0') as c18,
    coalesce(substring(m,19,1),'0') as c19,
    coalesce(substring(m,20,1),'0') as c20,
    coalesce(substring(m,21,1),'0') as c21,
    coalesce(substring(m,22,1),'0') as c22,
    coalesce(substring(m,23,1),'0') as c23,
    coalesce(substring(m,24,1),'0') as c24,
    coalesce(substring(m,25,1),'0') as c25,
    coalesce(substring(m,26,1),'0') as c26,
    coalesce(substring(m,27,1),'0') as c27,
    coalesce(substring(m,28,1),'0') as c28,
    coalesce(substring(m,29,1),'0') as c29,
    coalesce(substring(m,30,1),'0') as c30,
    coalesce(substring(m,31,1),'0') as c31,
    coalesce(substring(m,32,1),'0') as c32,
    coalesce(substring(m,33,1),'0') as c33,
    coalesce(substring(m,34,1),'0') as c34,
    coalesce(substring(m,35,1),'0') as c35,
    coalesce(substring(m,36,1),'0') as c36,
    coalesce(substring(m,37,1),'0') as c37,
    coalesce(substring(m,38,1),'0') as c38,
    coalesce(substring(m,39,1),'0') as c39,
    coalesce(substring(m,40,1),'0') as c40,
    coalesce(substring(m,41,1),'0') as c41,
    coalesce(substring(m,42,1),'0') as c42,
    coalesce(substring(m,43,1),'0') as c43,
    coalesce(substring(m,44,1),'0') as c44,
    coalesce(substring(m,45,1),'0') as c45,
    coalesce(substring(m,46,1),'0') as c46,
    coalesce(substring(m,47,1),'0') as c47,

    Один из вариантов решения задачи с форума сайта sql-ex (может стебный):
    Посчитать сумму цифр в номере каждой модели из таблицы Product
    Вывод: номер модели, сумма цифр

    Полный код все равно не помещается, значит его нельзя выдать за свой.

    crastinus, 08 Июня 2013

    Комментарии (17)
  4. SQL / Говнокод #13097

    −161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    CREATE TABLE blah (
      ...
      status ENUM('1', '2', '3') NOT NULL COMMENT "Статус модерации",
      ...
    );

    Модерация на раз-два-три.

    scriptin, 03 Июня 2013

    Комментарии (1)
  5. SQL / Говнокод #13040

    −158

    1. 1
    2. 2
    3. 3
    4. 4
    update "Employee"."Jobs" set "default_group_id" = '1' where "id" in (select "id" from "Employee"."Jobs" where title like '%родавец%');
    update "Employee"."Jobs" set "default_group_id" = '2' where "id" in (select "id" from "Employee"."Jobs" where title like '%правляющ%');
    update "Employee"."Jobs" set "default_group_id" = '3' where "id" in (select "id" from "Employee"."Jobs" where title like '%лиент%');
    update "Employee"."Jobs" set "default_group_id" = '4' where "id" in (select "id" from "Employee"."Jobs" where title like '%клад%' and title not like '%борщиц%');

    like '%клад% должен был включать всяких "работников склада" и "замзавсклада", но туда попала также и "уборщица склада" - пришлось заводить второе условие

    AntonioK, 23 Мая 2013

    Комментарии (13)
  6. SQL / Говнокод #13032

    −165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    delete
        from liaison
    where
        type = 'UsersGroup' and
        `group` = 'static_' || (select id from usergroup where name = :grp)

    Час назад вынес этим запросом все связи между группами и юзерами в боевой базе ;)

    P.S. Почему в mysql все дерьмо, работающее совсем не так, как оно работает почти во всех остальных СУБД, включено по умолчанию?

    bormand, 22 Мая 2013

    Комментарии (23)
  7. SQL / Говнокод #12953

    −164

    1. 1
    SELECT LAST_INSERT_ID() FROM comments;

    Подозреваю, что баян, но найти в чистом виде здесь не смог. Номинант на звание самого короткого анекдота на SQL.

    inkanus-gray, 29 Апреля 2013

    Комментарии (18)
  8. SQL / Говнокод #12882

    −163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $query = $sql -> query("SELECT *, COUNT(`id`) as count FROM `d_download` WHERE `id` = '{$id}'", true);
    
    if($query['count'] == 1) {
     // code
    }

    Проверка, что значение найдено.

    neTpyceB, 11 Апреля 2013

    Комментарии (10)
  9. SQL / Говнокод #12818

    −167

    1. 1
    2. 2
    3. 3
    update sometable
    set value2=convert(char(100),   @int_variable+convert(int,value2))
    where  someconditions

    В цикле колбасится, упростил для понимания.
    Мне кажется эту штуку изначально проектировал человек, который работал с bash и sqlite, а потом оппа, и нет слабой типизации.

    bliznezz, 28 Марта 2013

    Комментарии (3)
  10. SQL / Говнокод #12742

    −167

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    declare @billing_types table(k int null, t varchar(14)
    	collate SQL_Latin1_General_CP1255_CI_AS)
    insert @billing_types 
    values (1, 'אשרי')
    	   ,(2, 'צ׳ק')
    	   ,(3, 'הוראת קבע')
    
    declare @standing_order_status table(i int null, s varchar(14)
    	collate SQL_Latin1_General_CP1255_CI_AS)
    insert @standing_order_status 
    values (4, 'מבותל')
    	   ,(3, 'לא מאושר')
    	   ,(2, 'ממתין')
    	   ,(1, 'מאושר')
    
    declare @fax varchar(20)
    
    select billing_company_id
          ,internal_company_name
    	  ,isnull(t, 'לא פעיל') collate SQL_Latin1_General_CP1255_CI_AS as payment_type_string
          ,case when company_email is null then ''
    			when replace((ltrim(rtrim(company_email))), '0', '') = '' then ''
    			-- some emails were imported in the way, they aren't valid
    			when charindex('@', company_email) = 0 then ''
    			else (ltrim(rtrim(company_email))) end as email
          ,case when replace(ltrim(rtrim(company_fax)), '0', '') = '' 
    			then ''
    	   		when -- some times there are words like "none", "n/a" etc. in there
    			replace(replace(replace(replace(replace(replace(replace(
    				replace(replace(replace(replace(ltrim(rtrim(company_fax)), '-', ''), 
    				'0', ''), '1', ''), '2', ''), '3', ''), '4', ''), '5', ''), '6', ''),
    				'7', ''), '8', ''), '9', '') != '' 
    			then ''
    			else replace(ltrim(rtrim(company_fax)), '-', '')
    		end as c_fax
          ,ltrim(rtrim(company_address)) as c_address
          ,ltrim(rtrim(cast(company_comments as varchar(1000)))) as c_comments
          ,invoice_send_with_details
          ,invoice_send_fax
          ,invoice_print
          ,ltrim(rtrim(cc_name)) as c_name
          ,ltrim(rtrim(cc_number)) as c_number
          ,ltrim(rtrim(cc_cvv)) as c_cvv
          ,ltrim(rtrim(cc_id)) as c_id
          ,ltrim(rtrim(cc_expire)) as c_expire
          ,ltrim(rtrim(bank_number)) as number
          ,ltrim(rtrim(bank_branch)) as branch
          ,ltrim(rtrim(bank_account)) as account
          ,bank_hoshen
    	  ,isnull(s, 'אין') collate SQL_Latin1_General_CP1255_CI_AS as order_status
    from billing_companies
    left join @billing_types bt on bt.k = payment_type
    left join @standing_order_status os on os.i = bank_standing_order_status

    Война. Экспорт в Эксель, для того, чтобы потом ее обратно, но уже другим людям в базу передать.
    Из интересных подробностей. Поле "факс" в базе имеет тип varchar(50), например. Никакой серверной валидации отродясь не было. Иногда люди просто путали факс и электорпочту, когда заполняли данные.

    wvxvw, 13 Марта 2013

    Комментарии (15)