[ Príspevkov: 4 ] 
AutorSpráva
Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 11.12.07
Prihlásený: 13.06.24
Príspevky: 488
Témy: 139 | 139
Bydlisko: Bytča
NapísalOffline : 31.08.2014 19:50 | MySQL DB trigger

Zdravim, neviem ho rozbehat a to idem presne podla http://www.mysqltutorial.org/create-the ... mysql.aspx
kde moze byt hacik ?

napise mi>
Citácia:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$
CREATE TRIGGER before_employee_update
BEFORE UPDATE ON employ' at line 1


presne z toho webu si ztiahnem testovaciu DB: http://www.mysqltutorial.org/download/2

a potom pouzijem tieto prikazy, tiezpriamo z webu skopirovane:

Kód:
 CREATE TABLE employees_audit (
    id int(11) NOT NULL AUTO_INCREMENT,
    employeeNumber int(11) NOT NULL,
    lastname varchar(50) NOT NULL,
    changedon datetime DEFAULT NULL,
    action varchar(50) DEFAULT NULL,
    PRIMARY KEY (id)
)


a tento prikaz uz neprejde:

Kód:
DELIMITER $$
CREATE TRIGGER before_employee_update
    BEFORE UPDATE ON employees
    FOR EACH ROW BEGIN
 
    INSERT INTO employees_audit
    SET action = 'update',
         employeeNumber = OLD.employeeNumber,
        lastname = OLD.lastname,
        changedon = NOW();
END$$
DELIMITER ;


klasicky cez PhP My admin idem, skusal som aj cez mySQL Workbench, ta ista chyba


Offline

Užívateľ
Užívateľ
MySQL DB trigger

Registrovaný: 05.04.11
Príspevky: 1693
Témy: 50 | 50
Bydlisko: Žilina, Pop...
NapísalOffline : 01.09.2014 8:21 | MySQL DB trigger

Akú máš verziu mysql?


_________________
rMBP 13 2015
iPhone 7
Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 11.12.07
Prihlásený: 13.06.24
Príspevky: 488
Témy: 139 | 139
Bydlisko: Bytča
Napísal autor témyOffline : 01.09.2014 18:59 | MySQL DB trigger

The AppServ

Apache Web Server Version 2.2.8
PHP Script Language Version 5.2.6
MySQL Database Version 5.0.51b
phpMyAdmin Database Manager Version 2.10.3

// Spojený príspevok Pon 01.09.14 20:24

NIKTO tu nerobi v MySQL triggre?
rad by som vedel, ako sa to robi, aby tam ta chyba nebola


Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 23.09.13
Prihlásený: 04.12.14
Príspevky: 68
Témy: 1 | 1
NapísalOffline : 03.09.2014 8:37 | MySQL DB trigger

http://stackoverflow.com/questions/1130 ... nt-working

The DELIMITER keyword is client-specific, and a function of the MySQL command line client, not part of the actual MySQL language API. If you need to change the delimiter for DbVizualizer, there may be another method built into that application.

Cize tvoj kod by mohol vyzerat asi takto:
Kód:
CREATE TRIGGER before_employee_update
    BEFORE UPDATE ON employees
    FOR EACH ROW BEGIN
 
    INSERT INTO employees_audit
    SET action = 'update',
         employeeNumber = OLD.employeeNumber,
        lastname = OLD.lastname,
        changedon = NOW();
END


 [ Príspevkov: 4 ] 


MySQL DB trigger



Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy.

SQL Trigger

v Databázy

1

452

15.05.2013 22:51

XOLOO

V tomto fóre nie sú ďalšie neprečítané témy.

ORACLE TRIGGER

v Databázy

8

1189

15.04.2010 9:30

coldak

V tomto fóre nie sú ďalšie neprečítané témy.

MS SQL trigger

v Databázy

0

483

22.06.2016 20:12

expresado

V tomto fóre nie sú ďalšie neprečítané témy.

trigger alebo ine riesenie?

v Databázy

8

780

16.03.2011 0:15

TommyHot

V tomto fóre nie sú ďalšie neprečítané témy.

P: PS Vita Wifi + 8GB MC + Trigger grip + Vault Case + 4 hry

v Predám

14

948

27.11.2014 23:33

peto9110

V tomto fóre nie sú ďalšie neprečítané témy.

MySql

v Databázy

15

2313

26.03.2008 12:48

marekkk

V tomto fóre nie sú ďalšie neprečítané témy.

MysQl

v Databázy

2

793

28.10.2009 19:05

BYNGY

V tomto fóre nie sú ďalšie neprečítané témy.

MySQL

v Databázy

1

1083

25.03.2009 10:48

prostor

V tomto fóre nie sú ďalšie neprečítané témy.

MySQL

v Databázy

0

834

04.11.2020 15:19

jumper

V tomto fóre nie sú ďalšie neprečítané témy.

mysql where

v Databázy

1

781

26.08.2008 16:35

p360t

V tomto fóre nie sú ďalšie neprečítané témy.

MySQL UPDATE

v PHP, ASP

6

1063

25.11.2010 19:41

Ecko

V tomto fóre nie sú ďalšie neprečítané témy.

instalacia MySQL

v Databázy

6

883

24.05.2010 23:29

sedlák

V tomto fóre nie sú ďalšie neprečítané témy.

inštalácia mysql

v Databázy

7

1276

01.01.2010 19:36

Tominator

V tomto fóre nie sú ďalšie neprečítané témy.

MySQL REGEX

v Databázy

2

417

20.06.2013 16:16

Punker661

V tomto fóre nie sú ďalšie neprečítané témy.

Mysql Update

v Databázy

9

2663

11.01.2011 16:31

sonic

V tomto fóre nie sú ďalšie neprečítané témy.

mysql-vyhladavanie

v Databázy

5

673

11.11.2011 15:55

GoodWill



© 2005 - 2025 PCforum, edited by JanoF