ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
How can i give the restrictions for the data entry, if i 
wish to enter only I ,II, III, IV in the grade actegory of 
student table?
 Question Submitted By :: Prernagupta
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can i give the restrictions for the data entry, if i wish to enter only I ,II, III, IV in the grade actegory of student table?
Answer
# 1
use constraint or rules that will helps u in this query
we can also use cursor for this for insert
 
Is This Answer Correct ?    0 Yes 0 No
Pervej
 
  Re: How can i give the restrictions for the data entry, if i wish to enter only I ,II, III, IV in the grade actegory of student table?
Answer
# 2
If u Use SQLSERVER 2005. This will helpful to you


CREATE RULE myRule AS @strGrade IN('I','II','III','IV')
GO
CREATE TABLE myTable
   (
	empID	INT,
	empName	VARCHAR(50),
	empGrade	VARCHAR(3),
	empSalary	NUMERIC(9,2)
   );
GO
sp_bindrule myRule, 'myTable.empGrade';
GO


INSERT INTO myTable VALUES(1,'Ganesh','I',59000)   -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','II',89000)  -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','III',99000) -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','IV',259000) -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','V',259000)  -- 
Invalid
 
Is This Answer Correct ?    8 Yes 0 No
Soorai Ganesh
 
 
 
  Re: How can i give the restrictions for the data entry, if i wish to enter only I ,II, III, IV in the grade actegory of student table?
Answer
# 3
create table #test (sno int check(sno in(1,2,3)))

successfull statement:
insert into #test values(3)

failure statement :

insert into #test values(4)
error message:
INSERT statement conflicted with COLUMN CHECK 
constraint 'CK__#test__sno__68E599B5'. The conflict 
occurred in database 'tempdb', 
table '#test________________________________________________
____________________________________________________________
___00000000D7E0', column 'sno'.
The statement has been terminated.
 
Is This Answer Correct ?    0 Yes 0 No
Mohan
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
hi, i have a table called names and field name select * from names name a b c d i want to display like this name a,b,c,d how it is possible Regards Baiju  3
Can you give an example of Stored Procedure?  2
1.Describe way(s) to tune the SQL table in order to optimize performance. 2. Explain SQL Injection and how can you prevent them? Techno-Solutions1
what is differece between union and union all  4
how to rename the table  3
Lets say due to N/W or Security issues client is not able to connect to server or vice versa. How do you troubleshoot?  1
write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Name : emp2 empid empname 1 <Null> 2 <Null> Solution : emp1 names are updated in emp2, write a query?  7
what are file groups? Evalueserve3
What is the use of placing primary key and foreign key constrains on columns. Value-Labs2
What is transaction ? Give me one example. Melstar7
From where can you change the default port?  3
Explain sp_configure commands, set commands?  3
explain different types of jions with examples briefly? Zensar3
Why we need a group by clause?  3
how to get the maximum among two tables,for example table 1 (dep1) have (emp_id,emp_name,salary) columns and table 2 (dept2) have (emp_id,emp_name,salary) columns,i want which employee have the maximum salary among two tables? Lason2
Can you explain the types of Joins that we can have with Sql Server?  2
How to Generate a Series of Random Integers With T-SQL?  1
What are three SQL keywords used to change or set someone?s permissions?  3
what is the out put of below queries? a. select * from Emp where null = null; b. select * from Emp where 1=1; Patni9
where do you use Isolations?give me some exmpale?  1
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com