Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find if user can Truncate?
Message
 
 
À
02/01/2013 19:05:03
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01561130
Message ID:
01561142
Vues:
57
This message has been marked as a message which has helped to the initial question of the thread.
>Hi,
>
>Is it possible to determine (from a VFP application) if a user has SQL Server permission to Truncate a table? TIA.
>
>UPDATE: Or at least how to determine from the error number returned when executing Truncate table command that the problem was due to the user permission to Truncate?

See http://stackoverflow.com/questions/6063451/truncate-table-permissions

and then

http://sqltips.wordpress.com/2007/05/28/retreive-current-user-permissions-in-sql-server-2005/

So, you can run
if exists (select 1 from fn_my_permissions('MyTableName', 'object') where PERMISSION_NAME = 'ALTER')
  print 'Can truncate table'
ELSE
  print 'Do not have permissions to truncate table'
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform