Q&A

  • MSSQLㅡ> ACCESSdb로 변환후 에러임돠..(DECLARE @)
MSSQL을 ACCESSdb로 변환후 에러가 납니다..
DECLARE이 지원이 안되는건지.. 아니면 다른 함수를 써야되는지 모르겠어서여..

---------------------------------------------------------------------------------
var
slShop, slTsCode:String;
begin
    slShop   := DBLookupComboBox2.KeyValue;
    slTsCode := ADOQuery3.FieldByName('SI_TS_CODE').AsString;
    With ADOQuery7 do begin
         SQL.Clear;
         SQL.Add('DECLARE @TAMOUNT1 MONEY                                           ');
         SQL.Add('DECLARE @TAMOUNT2 MONEY                                           ');
         SQL.Add('    SET @TAMOUNT1 = (SELECT SUM(S.SL_AMOUNT) as TAMOUNT           ');
         SQL.Add('                       FROM SALES S                               ');
         SQL.Add('                      WHERE S.SL_DATE     = ''' + slDate   + '''  ');
         SQL.Add('                        AND S.SL_BS_SCODE = ''' + slShop   + '''  ');
         SQL.Add('                        AND S.SL_TS_CODE  = ''' + slTsCode + ''') ');
         SQL.Add('    SET @TAMOUNT2 = (SELECT SUM(A.AC_AMOUNT) as TAMOUNT           ');
         SQL.Add('                       FROM ACCOUNT A                             ');
         SQL.Add('                      WHERE A.AC_DATE     = ''' + slDate   + '''  ');
         SQL.Add('                        AND A.AC_BS_SCODE = ''' + slShop   + '''  ');
         SQL.Add('                        AND A.AC_TS_CODE  = ''' + slTsCode + '''  ');
         SQL.Add('                        AND A.AC_METHOD  <= ''2'')                ');
         SQL.Add('SELECT @TAMOUNT1 TAMT1, @TAMOUNT2 TAMT2                           ');
         Open;
    end;
---------------------------------------------------------------------------------

에러메세지...

SQL문이 잘못되었습니다. 'DELETE','INSERT','PROCEDURE','SELECT' 또는 'UPDATE'가 필요합니다.

고수님들.. 답변 부탁드립니다..
도와주세요~~~ ㅜㅜ
0  COMMENTS