- Posts: 291
- Thank you received: 8
Logged user / usable variable
6 years 3 weeks ago - 6 years 1 week ago #17099
by Bozik
Peter
Product: Visual Importer Enterprise & Active Table Editor
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit
Logged user / usable variable was created 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
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.
- Peter.Jonson
-
- Offline
- Platinum Member
-
6 years 3 weeks ago #17102
by Peter.Jonson
Peter Jonson
ETL Developer
Replied by Peter.Jonson on topic Logged user / usable variable
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.
6 years 3 weeks ago #17103
by Bozik
Peter
Product: Visual Importer Enterprise & Active Table Editor
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit
Replied by Bozik on topic Logged user / usable variable
Work well!
thx
Peter
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.
6 years 3 weeks ago - 6 years 3 weeks ago #17107
by Bozik
Peter
Product: Visual Importer Enterprise & Active Table Editor
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit
Replied by Bozik on topic Logged user / usable variable
Is there something similar for OBJECT ID? :whistle:
thx
Peter
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.
6 years 3 weeks ago #17109
by admin
Mike
ETL Architect
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?
How you are going to use it?
Mike
ETL Architect
Please Log in or Create an account to join the conversation.
6 years 3 weeks ago #17110
by Bozik
Peter
Product: Visual Importer Enterprise & Active Table Editor
Repository: Microsoft SQL Server - 11.0.2100.60
Windows: Server 2012 Standart 64Bit
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:
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

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.