Logged user / usable variable

More
6 years 3 weeks ago - 6 years 1 week ago #17099 by Bozik
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 & Active Table Editor
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit
Last edit: 6 years 1 week ago by Bozik.

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

More
6 years 3 weeks ago #17102 by Peter.Jonson
this one should work <ATEUserName>

Peter Jonson
ETL Developer
The following user(s) said Thank You: Bozik

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

More
6 years 3 weeks ago #17103 by Bozik
Replied by Bozik on topic Logged user / usable variable
Work well!
thx
Peter

Peter

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

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

More
6 years 3 weeks ago - 6 years 3 weeks ago #17107 by Bozik
Replied by Bozik on topic Logged user / usable variable
Is there something similar for OBJECT ID? :whistle:
thx
Peter

Peter

Product: Visual Importer Enterprise & Active Table Editor
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit
Last edit: 6 years 3 weeks ago by Bozik.

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

More
6 years 3 weeks ago #17109 by admin
Replied by admin on topic Logged user / usable variable
I do not really understand why you need it...
How you are going to use it?

Mike
ETL Architect

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

More
6 years 3 weeks ago #17110 by Bozik
Replied by Bozik on topic Logged user / usable variable
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:
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 & Active Table Editor
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit

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