Posts

Showing posts from 2014

How to add Primary Key and Auto Increment on different fields of MySql

 Normal code generated by MySql:- CREATE TABLE `categorymaster` (   ` CategoryID ` int(11) NOT NULL AUTO_INCREMENT,   ` Category ` varchar(200) DEFAULT NULL,   `IsActiv` int(11) DEFAULT NULL,   `ImagePath` varchar(200) DEFAULT NULL,   `DisplayOrder` int(11) DEFAULT NULL,   PRIMARY KEY (` Category `) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; In the above data stucture I want to make the " Category " as Primary Key and " CategoryId " as Auto Increment. But Table Wizard always give errors so, I decided to write my own Statement. Following is the statement which will create perfect structure according to my requirement. DROP TABLE `dbname`.`categorymaster`; CREATE TABLE `categorymaster` (   `CategoryId` int(11) unsigned NOT NULL AUTO_INCREMENT,   `Category` varchar(200) DEFAULT NULL,   `IsActiv` int(11) DEFAULT NULL,   `ImagePath` varchar(200) DEFAULT NULL,   `DisplayOrder` in...

How to create User Login in Sql Server 2005/2008

Image
How to create User Login in Sql Server 2005/2008 Note - You must be a member of "system admin" to create a new user or database. Following is the steps to create user login in database for database level security :- Step 1 . Open Sql Server >> Enter User Name >> Enter Password >> Click Connect Step 2 . Open Security >> Logins >> Right Click >> New Login Step 3. Enter login name >> Select Radio button "Sql Server Authentication" >>Enter password>>Enter confirm password>> Un-Check Enforce password policy >> Click Ok Step 4. Right click on Databases >> Click new database Step 5. Enter Database name>> Owner "<default>" >> Click Ok Step 6 . Open Newly created database (My Case it is Test)>> Security>> Users>> Right click on dbo >> New users. Step 7. Enter user name>> Login name >> default schema...