Sunteți pe pagina 1din 7

1. Which TCP/IP port does SQL Server run on? How can it be changed?

SQL Server runs on port 1433. It can be changed from the Network Uti it! "#$%I$ properties. . What are the di!!erence between c"ustered and a non#c"ustered inde$? 1. % c"ustered inde$ is a specia t!pe of inde& that reorders the wa! records in the tab e are ph!sica ! stored. "herefore tab e can have on ! one c ustered inde&. "he eaf nodes of a c ustered inde& contain the data pages. '. % non c"ustered inde$ is a specia t!pe of inde& in which the ogica order of the inde& does not match the ph!sica stored order of the rows on disk. "he eaf node of a non c ustered inde& does not consist of the data pages. Instead( the eaf nodes contain inde& rows. &. What are the di!!erent inde$ con!igurations a tab"e can have? ) tab e can have one of the fo owing inde& configurations* 1. No inde&es '. ) c ustered inde& 3. ) c ustered inde& and man! nonc ustered inde&es 4. ) nonc ustered inde& +. ,an! nonc ustered inde&es '. What are di!!erent t(pes o! Co""ation Sensitivit(? 1. Case sensitivit( - ) and a( . and b( etc. . %ccent sensitivit( 3. )ana Sensitivit( - /hen 0apanese kana characters 1iragana and 2atakana are treated different !( it is ca ed 2ana sensitive. 4. Width sensitivit( - ) sing e-b!te character 3ha f-width4 and the same character represented as a doub e-b!te character 3fu -width4 are treated different ! than it is width sensitive. *. What is +LTP ,+n"ine Transaction Processing-? In 5L"$ - on ine transaction processing s!stems re ationa database design use the discip ine of data mode ing and genera ! fo ow the #odd ru es of data norma i6ation in order to ensure abso ute data integrit!. Using these ru es comp e& information is broken down into its most simp e structures 3a tab e4 where a of the individua atomic eve e ements re ate to each other and satisf! the norma i6ation ru es. .. What/s the di!!erence between a pri0ar( 1e( and a uni2ue 1e(? .oth primar! ke! and uni7ue ke! enforces uni7ueness of the co umn on which the! are defined. .ut b! defau t primar! ke! creates a c ustered inde& on the co umn( where are uni7ue creates a nonc ustered inde& b! defau t. )nother ma8or difference is that( primar! ke! doesn9t a ow NULLs( but uni7ue ke! a ows one NULL on !.

3. What is di!!erence between 45L5T5 and T678C%T5 co00ands? :e ete command removes the rows from a tab e based on the condition that we provide with a /1;<; c ause. "runcate wi actua ! remove a the rows from a tab e and there wi be no data in the tab e after we run the truncate command. 1. T678C%T5* 1. "<UN#)"; is faster and uses fewer s!stem and transaction og resources than :;L;";. '. "<UN#)"; removes the data b! dea ocating the data pages used to store the tab e9s data( and on ! the page dea ocations are recorded in the transaction og. 3. "<UN#)"; removes a rows from a tab e( but the tab e structure( its co umns( constraints( inde&es and so on( remains. "he counter used b! an identit! for new rows is reset to the seed for the co umn. 4. =ou cannot use "<UN#)"; ").L; on a tab e referenced b! a >5<;I?N 2;= constraint. .ecause "<UN#)"; ").L; is not ogged( it cannot activate a trigger. +. "<UN#)"; cannot be ro ed back. @. "<UN#)"; is ::L #ommand. A. "<UN#)"; <esets identit! of the tab e '. 45L5T5* 1. :;L;"; removes rows one at a time and records an entr! in the transaction og for each de eted row. '. If !ou want to retain the identit! counter( use :;L;"; instead. If !ou want to remove tab e definition and its data( use the :<5$ ").L; statement. 3. :;L;"; #an be used with or without a /1;<; c ause 4. :;L;"; )ctivates "riggers. +. :;L;"; can be ro ed back. @. :;L;"; is :,L #ommand. A. :;L;"; does not reset identit! of the tab e. Note* :;L;"; and "<UN#)"; both can be ro ed back when surrounded b! "<)NS)#"I5N if the current session is not c osed. If "<UN#)"; is written in Quer! ;ditor surrounded b! "<)NS)#"I5N and if session is c osed( it can not be ro ed back but :;L;"; can be ro ed back. 9. When is the use o! 7P4%T5:ST%TISTICS co00and? "his command is basica ! used when a arge processing of data has occurred. If a arge amount of de etions an! modification or .u k #op! into the tab es has occurred( it has to update the inde&es to take these changes into account. U$:)";BS")"IS"I#S updates the inde&es on these tab es according !. C. /hat is the difference between a 1)DIN? #L)US; and a /1;<; #L)US;E "he! specif! a search condition for a group or an aggregate. .ut the difference is that 1)DIN? can be used on ! with the S;L;#" statement. 1)DIN? is t!pica ! used in a ?<5U$ .= c ause. /hen ?<5U$ .= is not used( 1)DIN? behaves ike a /1;<; c ause. 1aving # ause

is basica ! used on ! with the ?<5U$ .= function in a 7uer! whereas /1;<; # ause is app ied to each row before the! are part of the ?<5U$ .= function in a 7uer!.

1;. What are the properties and di!!erent T(pes o! Sub#Queries? 1. Properties o! Sub#Quer( 1. ) sub-7uer! must be enc osed in the parenthesis. '. ) sub-7uer! must be put in the right hand of the comparison operator( and 3. ) sub-7uer! cannot contain an 5<:;<-.= c ause. 4. ) 7uer! can contain more than one sub-7uer!. '. T(pes o! Sub#Quer( 1. Sing e-row sub-7uer!( where the sub-7uer! returns on ! one row. '. ,u tip e-row sub-7uer!( where the sub-7uer! returns mu tip e rows(. and 3. ,u tip e co umn sub-7uer!( where the sub-7uer! returns mu tip e co umns 11. What is SQL Pro!i"er? SQL $rofi er is a graphica too that a ows s!stem administrators to monitor events in an instance of ,icrosoft SQL Server. =ou can capture and save data about each event to a fi e or SQL Server tab e to ana !6e ater. >or e&amp e( !ou can monitor a production environment to see which stored procedures are hampering performances b! e&ecuting too s ow !. Use SQL $rofi er to monitor on ! the events in which !ou are interested. If traces are becoming too arge( !ou can fi ter them based on the information !ou want( so that on ! a subset of the event data is co ected. ,onitoring too man! events adds overhead to the server and the monitoring process and can cause the trace fi e or trace tab e to grow ver! arge( especia ! when the monitoring process takes p ace over a ong period of time. 1 . What are the authentication 0odes in SQL Server? How can it be changed? /indows mode and ,i&ed ,ode - SQL and /indows. "o change authentication mode in SQL Server c ick Start( $rograms( ,icrosoft SQL Server and c ick SQL ;nterprise ,anager to run SQL ;nterprise ,anager from the ,icrosoft SQL Server program group. Se ect the server then from the "oo s menu se ect SQL Server #onfiguration $roperties( and choose the Securit! page. 1&. Which co00and using Quer( %na"(<er wi"" give (ou the version o! SQL server and operating s(ste0? S;L;#" S;<D;<$<5$;<"= 39productversion94( S;<D;<$<5$;<"= 39product eve 94( S;<D;<$<5$;<"= 39edition94. 1'. What is SQL Server %gent? SQL Server agent p a!s an important ro e in the da!-to-da! tasks of a database administrator 3:.)4. It is often over ooked as one of the main too s for SQL Server management. Its purpose is to ease the imp ementation of tasks for the :.)( with its fu - function schedu ing engine( which a ows !ou to schedu e !our own 8obs and scripts.

1*. Can a stored procedure ca"" itse"! or recursive stored procedure? How 0uch "eve" SP nesting is possib"e? =es. .ecause "ransact-SQL supports recursion( !ou can write stored procedures that ca themse ves. <ecursion can be defined as a method of prob em so ving wherein the so ution is arrived at b! repetitive ! app !ing it to subsets of the prob em. ) common app ication of recursive ogic is to perform numeric computations that end themse ves to repetitive eva uation b! the same processing steps. Stored procedures are nested when one stored procedure ca s another or e&ecutes managed code b! referencing a #L< routine( t!pe( or aggregate. =ou can nest stored procedures and managed code references up to 3' eve s. 1.. What is Log Shipping? Log shipping is the process of automating the backup of database and transaction og fi es on a production SQL server( and then restoring them onto a standb! server. ;nterprise ;ditions on ! supports og shipping. In og shipping the transactiona og fi e from one server is automatica ! updated into the backup database on the other server. If one server fai s( the other server wi have the same db and can be used this as the :isaster <ecover! p an. "he ke! feature of og shipping is that it wi automatica ! backup transaction ogs throughout the da! and automatica ! restore them on the standb! server at defined interva . 13. 8a0e & wa(s to get an accurate count o! the nu0ber o! records in a tab"e? S;L;#" F ><5, tab e1 S;L;#" #5UN"3F4 ><5, tab e1 S;L;#" rows ><5, s!sinde&es /1;<; id G 5.0;#"BI:3tab e14 )N: indid H ' 19. What does it 0ean to have Q7+T54:I458TI=I56 +8? What are the i0p"ications o! having it +==? /hen S;" QU5";:BI:;N"I>I;< is 5N( identifiers can be de imited b! doub e 7uotation marks( and itera s must be de imited b! sing e 7uotation marks. /hen S;" QU5";:BI:;N"I>I;< is 5>>( identifiers cannot be 7uoted and must fo ow a "ransact-SQL ru es for identifiers. 1>. What is the di!!erence between a Loca" and a ?"oba" te0porar( tab"e? 1. % "oca" te0porar( tab e e&ists on ! for the duration of a connection or( if defined inside a compound statement( for the duration of the compound statement. '. % g"oba" te0porar( tab e remains in the database permanent !( but the rows e&ist on ! within a given connection. /hen connection is c osed( the data in the g oba temporar! tab e disappears. 1owever( the tab e definition remains with the database for access when database is opened ne&t time. ;. What is the ST7== !unction and how does it di!!er !ro0 the 65PL%C5 !unction? S"U>> function is used to overwrite e&isting characters. Using this s!nta&( S"U>> 3stringBe&pression( start( ength( rep acementBcharacters4( stringBe&pression is the string that wi have characters substituted( start is the starting position( ength is the number of characters

in the string that are substituted( and rep acementBcharacters are the new characters inter8ected into the string. <;$L)#; function to rep ace e&isting characters of a occurrences. Using the s!nta& <;$L)#; 3stringBe&pression( searchBstring( rep acementBstring4( where ever! incidence of searchBstring found in the stringBe&pression wi be rep aced with rep acementBstring. 1. What is P6I@%6A )5A? ) $<I,)<= 2;= constraint is a uni7ue identifier for a row within a database tab e. ;ver! tab e shou d have a primar! ke! constraint to uni7ue ! identif! each row and on ! one primar! ke! constraint can be created for each tab e. "he primar! ke! constraints are used to enforce entit! integrit!. . What is 78IQ75 )5A constraint? ) UNIQU; constraint enforces the uni7ueness of the va ues in a set of co umns( so no dup icate va ues are entered. "he uni7ue ke! constraints are used to enforce entit! integrit! as the primar! ke! constraints. &. What is =+65I?8 )5A? ) >5<;I?N 2;= constraint prevents an! actions that wou d destro! inks between tab es with the corresponding data va ues. ) foreign ke! in one tab e points to a primar! ke! in another tab e. >oreign ke!s prevent actions that wou d eave rows with foreign ke! va ues when there are no primar! ke!s with that va ue. "he foreign ke! constraints are used to enforce referentia integrit!. '. What is CH5C) Constraint? ) #1;#2 constraint is used to imit the va ues that can be p aced in a co umn. "he check constraints are used to enforce domain integrit!. *. What is 8+T 87LL Constraint? ) N5" NULL constraint enforces that the co umn wi not accept nu va ues. "he not nu constraints are used to enforce domain integrit!( as the check constraints. .. How to get BB566+6 and BB6+WC+78T at the sa0e ti0e? If II<owcount is checked after ;rror checking statement then it wi have J as the va ue of II<ecordcount as it wou d have been reset. )nd if II<ecordcount is checked before the error-checking statement then II;rror wou d get reset. "o get IIerror and IIrowcount at the same time do both in same statement and store them in oca variab e. S;L;#" I<# G II<5/#5UN"( I;< G II;<<5< 3. What is a Schedu"ed Cobs or What is a Schedu"ed Tas1s? Schedu ed tasks et user automate processes that run on regu ar or predictab e c!c es. User can schedu e administrative tasks( such as cube processing( to run during times of s ow business activit!. User can a so determine the order in which tasks run b! creating 8ob steps within a SQL Server )gent 8ob. ;.g. back up database( Update Stats of "ab es. 0ob steps give

user contro over f ow of e&ecution. If one 8ob fai s( user can configure SQL Server )gent to continue to run the remaining tasks or to stop e&ecution. 9. What are the advantages o! using Stored Procedures? 1. Stored procedure can reduced network traffic and atenc!( boosting app ication performance. '. Stored procedure e&ecution p ans can be reused( sta!ing cached in SQL Server9s memor!( reducing server overhead. 3. Stored procedures he p promote code reuse. 4. Stored procedures can encapsu ate ogic. =ou can change stored procedure code without affecting c ients. +. Stored procedures provide better securit! to !our data. >. What is a tab"e ca""edD i! it has neither C"uster nor 8on#c"uster Inde$? What is it used !or? Uninde&ed tab e or 1eap. ,icrosoft $ress .ooks and .ook on Line 3.5L4 refers it as 1eap. ) heap is a tab e that does not have a c ustered inde& and( therefore( the pages are not inked b! pointers. "he I), pages are the on ! structures that ink the pages in a tab e together. Uninde&ed tab es are good for fast storing of data. ,an! times it is better to drop a inde&es from tab e and then do bu k of inserts and to restore those inde&es after that. &;. Can SQL Servers "in1ed to other servers "i1e +rac"e? SQL Server can be inked to an! server provided it has 5L;-:. provider from ,icrosoft to a ow a ink. ;.g. 5rac e has an 5L;-:. provider for orac e that ,icrosoft provides to add it as inked server to SQL Server group. &1. What is ECP? When does it used? .u k#op! is a too used to cop! huge amount of data from tab es and views. .#$ does not cop! the structures same as source to destination. .UL2 INS;<" command he ps to import a data fi e into a database tab e or view in a user-specified format. & . How to i0p"e0ent one#to#oneD one#to#0an( and 0an(#to#0an( re"ationships whi"e designing tab"es? 5ne-to-5ne re ationship can be imp emented as a sing e tab e and rare ! as two tab es with primar! and foreign ke! re ationships. 5ne-to-,an! re ationships are imp emented b! sp itting the data into two tab es with primar! ke! and foreign ke! re ationships. ,an!-to-,an! re ationships are imp emented using a 8unction tab e with the ke!s from both the tab es forming the composite primar! ke! of the 8unction tab e. &&. What is an e$ecution p"an? When wou"d (ou use it? How wou"d (ou view the e$ecution p"an? )n e&ecution p an is basica ! a road map that graphica ! or te&tua ! shows the data retrieva methods chosen b! the SQL Server 7uer! optimi6er for a stored procedure or ad- hoc 7uer! and is a ver! usefu too for a deve oper to understand the performance characteristics of a

7uer! or stored procedure since the p an is the one that SQL Server wi p ace in its cache and use to e&ecute the stored procedure or 7uer!. >rom within Quer! )na !6er is an option ca ed KShow ;&ecution $ anK 3 ocated on the Quer! drop-down menu4. If this option is turned on it wi disp a! 7uer! e&ecution p an in separate window when 7uer! is ran again.

S-ar putea să vă placă și