Welcome, Guest
Username: Password: Remember me

TOPIC: Logged user / usable variable

Logged user / usable variable 1 year 8 months ago #17099

  • Bozik
  • Bozik's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 232
  • Thank you received: 2
Hi,
I want to ask or does not exist variable for current logged user, Usable for example in sql?

Example:
SELECT id,name FROM customer WHERE creator = <username>

Thanks
Peter
Peter

Product: Visual Importer Enterprise
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit

Please Log in or Create an account to join the conversation.

Logged user / usable variable 1 year 8 months ago #17102

this one should work <ATEUserName>
Peter Jonson
Support Analist
The following user(s) said Thank You: Bozik

Please Log in or Create an account to join the conversation.

Logged user / usable variable 1 year 8 months ago #17103

  • Bozik
  • Bozik's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 232
  • Thank you received: 2
Work well!
thx
Peter
Peter

Product: Visual Importer Enterprise
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit

Please Log in or Create an account to join the conversation.

Logged user / usable variable 1 year 8 months ago #17107

  • Bozik
  • Bozik's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 232
  • Thank you received: 2
Is there something similar for OBJECT ID? :whistle:
thx
Peter
Peter

Product: Visual Importer Enterprise
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit

Please Log in or Create an account to join the conversation.

Logged user / usable variable 1 year 8 months ago #17109

  • admin
  • admin's Avatar
  • Offline
  • Moderator
  • Moderator
  • Deeds not Words
  • Posts: 7513
  • Karma: 33
  • Thank you received: 409
I do not really understand why you need it...
How you are going to use it?
Mike

Please Log in or Create an account to join the conversation.

Logged user / usable variable 1 year 8 months ago #17110

  • Bozik
  • Bozik's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 232
  • Thank you received: 2
Hi,
i want to use with stored procedure.
I have created table with user parameters "`LMXDATSK`.`ATABLEPAR`". In this table I want to save parameters of users. Primary key of this table is logged user and object ID. To always secure right number of object when saving, i have options 1, to edit this parameter manually or 2, "set him" by existing parameter. This is very briefly explained :), But basically I want to secure correct usage of one object by more users..

SAMPLE CODE:
/* Entry parameter for object */
SET @ItemId        := 4659;
SET @Vytvoril      := '<ATEUserName>';
SET @Vytvorenie := DATE_FORMAT(now(), '%Y%m%d%H%i%S');
SET @ParExists  := EXISTS(SELECT *
                           FROM `LMXDATSK`.`ATABLEPAR`
                          WHERE `ItemId` = @ItemId
                            AND `Vytvoril`= @Vytvoril COLLATE utf8_general_ci);

/* Stored procedure - insert parameter row for object when not EXISTS */
CALL `lmxdatsk`.`spATable_ParCreator`(@ParExists,@ItemId,@Vytvoril,@Vytvorenie);

/* FINAL SELECT*/
SELECT `ATABLEPAR`.*,
       (SELECT SUM(`PHFH`)
          FROM `CLODATSK`.`COLFH`
         INNER JOIN `LMXDATSK`.`ATABLEPAR`
            ON(`FNRFH` = `TEXTPAR1`)
           AND(`FDFH` = `DATEPAR1`)
         WHERE `IDPFH` = 10
        ) as CSuma
  FROM `LMXDATSK`.`ATABLEPAR`
 WHERE `ItemId` = @ItemId
   AND `Vytvoril`= @Vytvoril COLLATE utf8_general_ci ;
Peter

Product: Visual Importer Enterprise
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit

Please Log in or Create an account to join the conversation.

We have 289 guests and 2 members online