I am looking for few global variable in mysql which are equivalent of sql server.
我正在尋找mysql中的幾個全局變量,它們相當於sql server。
I want the whole list eg.
我要整張表。
Sql Server Equivalent
Sql Server等效
@@error ---
@ error - - -
@@Identity ---
@@Identity - - -
etc.
等。
Basically right now I want to know what are the equivalent variable of @@error and @@identity.
基本上現在我想知道@error和@@identity的等價變量是什么。
But it will be helpfull if u could provide some other variable also
但是如果你也能提供一些其他的變量,那將會很有幫助
1 个解决方案
#1
5
The last auto_increment value (i.e. the last identity) generated for the current connection can be found using the
可以使用LAST_INSERT_ID()函數找到為當前連接生成的最后一個auto_increment值(即最后一個標識)。
About errors, not sure ; there doesn't seem to be any
關於錯誤,不確定;似乎沒有任何系統變量對應於最后一條錯誤消息。
There is a show errors statement :
有一個show errors語句:
mysql> select a from b;
ERROR 1046 (3D000): No database selected
mysql> show errors;
+-------+------+----------------------+
| Level | Code | Message |
+-------+------+----------------------+
| Error | 1046 | No database selected |
+-------+------+----------------------+
1 row in set (0,00 sec)
But not sure how you can use this result...
但不知道如何使用這個結果……
After searching a bit more, I found out this thread : (quoting) :
在進一步搜索之后,我發現了這個線程:獲取最后一條錯誤消息(引用):
I think there should be something like @@last_error_id and @@last_error_message, but I can`t find anything in the current manual.
我認為應該有@@last_error_id和@last_error_message這樣的內容,但是我在當前手冊中找不到任何內容。
And the first answer states (quoting) :
第一個回答說(引用):
This isn't possible currently, from what we understand error handling will be improved in version 5.2 and hopefully something like this may be possible.
這在目前是不可能的,根據我們所理解的錯誤處理將在5.2版本中得到改進,希望類似這樣的事情能夠成為可能。