Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

For example, in T-SQL:

IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = 'myLogin')
BEGIN
CREATE LOGIN [myLogin] WITH 
    PASSWORD = 0x01006EBFC766EDE94EA7891A5C1EE5FFDECD54454751A6B43222 HASHED, 
    SID = 0x07DF3EB73FC28848A0FB8F66BA165FED, 
    CHECK_POLICY = OFF, 
    CHECK_EXPIRATION = OFF
END

The above script can be executed once or twice or 10 times or even a billion times and the final result will be identical (if there isn't already a 'myLogin', it will be created.)

So, what is the name for such a script / procedure?

share|improve this question

closed as unclear what you're asking by RolandoMySQLDBA, Michael - sqlbot, Max Vernon, Mark Storey-Smith, Kin Dec 28 '13 at 3:39

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

6  
I'm afraid I don't understand what the question is and suspect others won't either. Maybe you are asking about idempotence? –  James Dec 27 '13 at 12:22
    
Maybe question is about stored procedure ??? –  Kuba Miazek Dec 27 '13 at 12:34
    
@James - yep that's the word, I couldn't remember it, thanks! –  halophilic Dec 27 '13 at 13:25
1  
"Any number of times" is not exactly the same as idempotenpt though. –  ypercube Dec 27 '13 at 20:35
1  
Neither is 'without errors', as far as I understand. I think the question could use some clarification in order to be answerable and potentially useful to people finding it through Google. –  James Dec 27 '13 at 23:21

Browse other questions tagged or ask your own question.