Announcement

Collapse
No announcement yet.

How to enter function values in tables ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to enter function values in tables ?

    I need to insert often current date values in my tables, such as CURRENT-DATE, CURRENT-TIME. How to do that in the table grid o form views ?
    It works when you do write the INSERT statement in SQL, but not from the table editing view.
    I tried siwtching to raw mode, to no avail. (BTW, whats the use of the Raw mode while editing a table ?)

  • #2
    You can try to employ the Raw Edit feature and type the function on the cell directly, e.g. PASSWORD('123abc'). Open the table, choose View > Raw Mode.

    Comment


    • #3
      Thank for this helpful information. The following Navicat 11 Help info was in my opinion also helpful.

      Manipulating Raw Data Navicat normally recognize what user has input in grid as normal string, any special characters or functions would be processed as plain text (that is, its functionality would be skipped).
      Editing data in Raw Mode provides an ease and direct method to apply server built-in function. To access the Raw Mode function, control-click a field and select Raw from the pop-up menu.
      Note: Available only for MySQL, PostgreSQL, SQLite, SQL Server and MariaDB. (see also photo 1)

      I could however not find a method to add a timestamp by default for fields I assign to contain this information.

      Do you know a way to add this timestamp by default?

      If I place:

      datetime()

      as default value then I get the message: Error
      near "(": syntax error

      Thank you in advance for your help.


      [IMG]file:///Applications/Navicat%20for%20SQLite.app/Contents/Resources/en.lproj/Navicat%20Premium%20Help/img/rawMode.png[/IMG]
      Last edited by NavicatUserSqlite; 08-23-2014, 06:14 PM.

      Comment


      • #4
        I think I found the answer....

        Instead of writing datetime()

        one needs to add parentheses (if you want the date and time by default)

        (datetime())

        Comment

        Working...
        X