Using sa user I am crating table and am able give GRANT Options .But not for Non-sa user(Test user).
//Coding creating table in Dynamics database.
string checkTable = String.Format("IF OBJECT_ID('{0}', 'U') IS NOT NULL SELECT 'true' ELSE SELECT 'false'", " ocgregistration");
SqlCommand command = new SqlCommand( checkTable , SQLConnection);
bool exist = Convert.ToBoolean(command.ExecuteScalar);
if (exist == false)
{
sql = "create table ocgregistration(col1 varchar(150), col2 varchar(150), col3 varchar(150))";
cmd = new SqlCommand(sql, SQLConnection );
cmd.ExecuteNonQuery();//Getting Error :Permission denied Creating table.
string Grant = "GRANT SELECT,UPDATE,INSERT,DELETE,ALTER ON ocgregistration TO DYNGRP";
cmd = new SqlCommand(Grant, SQLConnection );
cmd.ExecuteNonQuery();
}
I am getting same error message if I try to create a table in TWO database (Permission denied Creating table. )
Is there any other setting for non-sa user through sql server (and) c# code for creating table and GRANT option.