Showing posts with label SQL SERVER. Show all posts
Showing posts with label SQL SERVER. Show all posts

Friday, 21 January 2011

Step by Step Guide to Add a SQL Job in SQL Server 2005

Step by Step Guide to Add a SQL Job in SQL Server 2005
Describes Step by Step process of adding a sql job in SQL Server 2005

http://www.dailycoding.com/Posts/step_by_step_guide_to_add_a_sql_job_in_sql_server_2005.aspx


This is about adding a new SQL Jobs in the Sql Server 2005.

Step 1
Make sure that the SQL Server Agent is up and running. You can see it in the taskbar icon.

If SQL Server Agent is not running, start it from the SQL Server Configuration Manger


You can also start the SQL Server Agent from the command prompt using the command netstart
net start "SQL Server Agent ()"
e.g net start "SQL Server Agent (SQLSERVER01)"
Step 2
Connect to the database engine of SQL server using SQL Server Management Studio.

Step 3
Expand the SQL Server Agent. You will see a Jobs folder over there. Right click on jobs and choose Add New.

Step 4
A New Job popup will appear. Specify the name of the job.

Step 5
Cilck next on the "Steps" in the left menu. A sql job can contain one or more steps. A step might be simply an sql statement or a stored procedure call. Add you step here

Job step added


Step 5
Cilck next on the "Schedules" in the left menu. A sql job can contain one or more schedules. A schedule is basically the time at which sql job will run it self. You can specify recurring schedules also.

Job schedule added


You sql job is ready now. However there are other thing you can use if needed like Alert, Notifications etc.

Saturday, 8 January 2011

Experience Interview 2

How and when to use LIKE statement
Get top two records without Top keyword
set rowcount 2 select column,column1 from tblEmployeeMaster
Difference between Set and Select
Set is a ANSI standard for variable assignment.Select is a Non-ANSI standard when assigning variables.We can assign only one variable at a time.We can assign multiple variable at a time
When assigning from a query that returns more than one value, SET will fail with an error.When assigning from a query that returns more than one value, SELECT will assign the last value returned by the query and hide the fact that the query returned
more than one row.

What is the use of OLAP

OLAP is useful because it provides fast and interactive access to aggregated data and the ability to drill down to detail.
Provide all the built in string function of SQL SERVER
ASCII, NCHAR, SOUNDEX, CHAR, PATINDEX, SPACE, CHARINDEX, REPLACE, STR, DIFFERENCE, QUOTENAME, STUFF, LEFT, REPLICATE, SUBSTRING, LEN, REVERSE, UNICODE, LOWER, RIGHT, UPPER, LTRIM, RTRIM
How many objects SQL Server contains
Here is the list of some of the more important database objects ,database, The transaction log, Assemblies, Tables, Reports, File groups, Full-text catalogs, Diagrams, User-defined data types, Views, Roles, Stored procedures, Users, User Defined Functions

Diffrence between varchar and nvarchar
An nvarchar column can store any Unicode data. A varchar column is restricted to an 8-bit codepage. Some people think that varchar should be used because it takes up less space. I believe this is not the correct answer. Codepage incompatabilities are a pain, and Unicode is the cure for codepage problems. With cheap disk and memory nowadays, there is really no reason to waste time mucking around with code pages anymore.
Why we use SET ROWCOUNT in Sql
This syntax is used in SQL Server to stop processing the query after the specified number of rows are returned.
Why we use Unicode In Sql server
Unicode data is stored using the nchar, nvarchar,and ntext data types in SQL Server. Use these data types for columns that store characters from more than one character set. The SQL Server Unicode data types are based on the National Character data types in the SQL-92 standard.
Difference between Triggers and Storedprocedures
Triggers are basically used to implement business rules.Triggers is also similar to stored procedures.The difference is that it can be activated when data is added or edited or deleted from a table in a database.Triggers are special kind of stored procedures that get executed automatically when an INSERT,UPDATE or DELETE operation takes place on a table.
How to get all the parameter of store procedure through query
private void bindParameters( string strName){
SqlConnection conn = new SqlConnection(connectionstring);StringBuilder stbr = new StringBuilder();sb.Append("select s.id, s.name, t.name as [type], t.length ");sb.Append("from syscolumns s ");sb.Append("inner join systypes t ");sb.Append("on s.xtype = t.xtype ");
sb.Append("where id = (select id from sysobjects where name='" + strName + "')"
);SqlDataAdapter adapter = new SqlDataAdapter(stbr.ToString(), conn);
DataTable dt = new DataTable();try{conn.Open();adapter.Fill(dt);DataGrid1.DataSource=dt; //bind parametr with datagrid for visual DataGrid1.DataBind();}catch (Exception ex){
lblException.Text = ex.ToString();}finally{conn.Close();}}

What is SQL tuning
SQL tuning is the process of getting that the SQL statements that an application that will issue that's run in the fastest possible time.
What is SET operator in SQL SERVER
SET operators mainly used to combine same type of data from two or more tables.And another thing is that columns and their data type should be same as all the queries have.The column names from the first query will appear in the result.
UNION - It produce rows of Ist query + rows of 2nd query minus duplicate rows. UNION ALL - It produce rows from both the queries including duplicate rows. MINUS - Rows that are unique for the 1st query will be retrieved
INTERSECT - common rows from both the queries will be retrieved. Join is used to select columns from two or more tables.

Can you define ROLLUP in SQL SERVER 2005
ROLLUP work with the "Group By " clause its main functioning comes into existance when we use Group by. We can get sub-total of row by using the Rollup funtion.When result is return by Group By class first row display the grand total or we can say that the main total. syntax:-select firstcolumn,secondcolumn,sum(thirdcolumn) from tablename group by firstcolumn,secondcolumn with rollup order by firstcolumn.

How many records can take clustured index in sql
A clustered index is a special type of index that reorders the way the records in the table are physically stored . therefore the table can have only one clustered index.
What are Checkpoint in SQL Server

When we done operation on SQL SERVER that is not commited directly to the database.All operation must be logged in to Transaction Log files after that they should be done on to the main database.CheckPoint are the point which alert Sql Server to save all the data to main database if no Check point is there then log files get full we can use Checkpoint command to commit all data in the SQL SERVER.When we stop the SQL Server it will take long time because Checkpoint is also fired


Write a Role of Sql Server 2005 in XML Web Services
SQL Server 2005 create a standard method for getting the database engine using SOAP via HTTP. By this method, we can send SOAP/HTTP requests to SQL Server for executing T-SQL batch statements, stored procedures, extended stored procedures, and scalar-valued user-defined functions may be with or without parameters.

What are the different types of Locks
There are three main types of locks that SQL Server
(1)Shared locks are used for an operation that does not allow to change or update data, such as a SELECT statement.
(2)Update locks are used when SQL Server intends to modify a page, and later promotes the update page lock to an exclusive page lock before actually making the changes.
(3)Exclusive locks are used for the data modification operations, such as UPDATE, INSERT, or DELETE.

What is COMMIT and ROLLBACK statement in SQL
Commit statement helps in termination of the current transaction and do all the changes that occur in transaction persistent and this also commits all the changes to the database.COMMIT we can also use in store procedure. ROLLBACK do the same thing just terminate the currenct transaction but one another thing is that the changes made to database are ROLLBACK to the database.
what is Relational Database
What is the use of DBCC commands
DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks. DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked. and DBCC CHECKALLOC To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE
Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
Can you explain what View is in SQL
View is just a virtual table nothing else which is based or we can say devlop with SQL SELECT query
What is Collate in SQL SERVER2000
The COLLATE clause can be applied only for the char, varchar, text, nchar, nvarchar, and ntext data types.
What is Cursor
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis
Use of Cursor?
What is sub‐query?
Sub‐queries are often referred to as sub‐selects, as they allow a SELECT statement to be executed arbitrarily within the body of another SQL statement. A sub‐query is executed by enclosing it in a set of parentheses. Sub‐queries are generally used to return a single row as an atomic value, though they may be used to compare values against multiple rows with the IN keyword.
What are primary keys and foreign keys?
What is User Defined Functions?
What is Identity?
Which TCP/IP port does SQL Server run on? How can it be changed?

What are the difference between clustered and a non‐clustered index? (Read More Here)
A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

What is SQL Profiler?
What are the authentication modes in SQL Server? How can it be changed?
Windows mode and Mixed Mode ‐ SQL & Windows.
What is Log Shipping?
Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. Enterprise Editions only supports log shipping. In log shipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and can be used this as the Disaster Recovery plan. The key feature of log shipping is that it will automatically backup transaction logs throughout the day and automatically restore them on the standby server at defined interval.
What is UNIQUE KEY constraint?
A UNIQUE constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The unique key constraints are used to enforce entity integrity as the primary key constraints.
What is FOREIGN KEY?
What is CHECK Constraint?
A CHECK constraint is used to limit the values that can be placed in a column. The check constraints are used to enforce domain integrity
What is NOT NULL Constraint?
How to get @@ERROR and @@ROWCOUNT at the same time?
If @@Rowcount is checked after Error checking statement then it will have 0 as the value of @@Recordcount as it would have been reset. And if @@Recordcount is checked before the error‐checking statement then @@Error would get reset. To get @@error and @@rowcount at the same time do both in same statement and store them in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR
What are the advantages of using Stored Procedures?
Can SQL Servers linked to other servers like Oracle?
SQL Server can be linked to any server provided it has OLE‐DB provider from Microsoft to allow a link. E.g. Oracle has an OLE‐DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group
What is PIVOT ?
A Pivot Table can automatically sort,count,and total the data stored in one table or
spreadsheet and create a second table displaying the summarized data. The PIVOT operator turns the values of a specified column into column names, effectively rotating a table.

JavaScript
1. What’s relationship between JavaScript and ECMAScript? - ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.
2. What are JavaScript types? - Number, String, Boolean, Function, Object, Null, Undefined.
3. How do you convert numbers between different bases in JavaScript? - Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);
4. What does isNaN function do? - Return true if the argument is not a number.
5. What is negative infinity? - It’s a number in JavaScript, derived by dividing negative number by zero.
6. What boolean operators does JavaScript support? - &&, || and !
7. What does "1"+2+4 evaluate to? - Since 1 is a string, everything is a string, so the result is 124.
8. How about 2+5+"8"? - Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it’s concatenation, so 78 is the result.
9. What looping structures are there in JavaScript? - for, while, do-while loops, but no foreach.
10. How do you create a new object in JavaScript? - var obj = new Object(); or var obj = {};
11. How do you assign object properties? - obj["age"] = 17 or obj.age = 17.
12. What’s a way to append a value to an array? - arr[arr.length] = value;
13. What is this keyword? - It refers to the current object.
What is the difference between an alert box and a confirmation box?


What is a prompt box?


How to use "join()" to create a string from an array using JavaScript?


What's Prototypes for JavaScript?


How to create arrays in JavaScript?


How to shift and unshift using JavaScript?


How do you submit a form using Javascript?


What are the problems associated with using JavaScript, and are there JavaScript techniques that you discourage?


How to redirect a page using JavaScript
Latest Answer: window.location="filename" ...

Implement Timer Control
How to implement timer control in JavaScript
Latest Answer: set Timedout("alert('5 seconds')",5000);will display display alert box after 5 seconds ...
How do you get field value in javascript?
Latest Answer: You can use either 1. document.getElementById("").valueor2. document.forms[0]..value
How do you check validations in javascript?
How do you restrict user not to copy web page in Java Script ?
Latest Answer: By disabling right click we can restrict user not to copy webpage sourcecode.
Script to check every character
How will you insert data into db2 using JavaScript?
What is the main difference between Client side JavaScript and and Server side Java Script. How actually
How to add a combo box dynamically at run time in Java script?
How to create an Object in JavaScript ?
Posted by: Puneet20884 | Show/Hide Answer
1) var obj = new Object();
2) var ob = {};
Write a way by which you can do something on the close of the window ?

call onUnload on the body tag and write your javascript code there
Is it possible make a call to server side event of any button using javascript?

Yes, it's possible. You can use __doPostBack() function to call server side event.
Can Javascript code be broken in different lines?
Yes,
Breaking is possible within a string statement by using a backslash "\" at the end .
Ex:
document.write("Good Morning. \
I am Mr. John");

But it is not possible within any other javascript statement.
Ex :
is possible but not
document.write \
("Good Morning. I am Mr. John");
What is undefined value means in JavaScript?
There can be multiple reasons of having undefined values
1. Object does not exist. Like you create an object of a control which does not exists in your page and when you access it, it is undefined.
2. No value is assigned to the object.
3. If you are trying to access a property which does not exists for the object

What is the result of below given line of code in Java Script? 5+4+'7'
The answer is 97.

As 5 and 4 are integer so total becomes 9 and it's add '7' to it as string so it becomes 97.
Which method is used to Clear an array using JavaSctipt?
Clear();
Which method is used to convert a string to uppercase letters?
toUpperCase()
Name the DataTypes of JavaScript?

1)Integer

2)String

3)Boolean

4)Null

Which of the following is not considered a JavaScript keyword?
This
How to get value from RadioButtonList control?
Here id is the name property of the RadioButtonList


function GetRadioButtonValue(id)

{

var radio = document.getElementsByName(id);

for (var ii = 0; ii < radio.length; ii++)

{

if (radio[ii].checked)

alert(radio[ii].value);

}

}

How to get value from dropdown (select) control?
Write following code

alert(document.getElementById('dropdown1').value);
How to get CheckBox status whether it is checked or not?
Write following code

alert(document.getElementById('checkbox1').checked);

if it will be checked you will get true else false.

Experience Interview 1

1. Can you say something about your self
2. Which College you from?
2. Which is the best project you have done till now ? and in what sense the project was the best ?
3. Do you work on staurday’ and sunday’s ?
4. Have you done any kind of certification ?
How would you describe yourself ?
What type of environment you are looking for ?
How well do you work with people? Do you prefer working alone or in teams?
What have your learnt from your past project experiences ?
Where you a part of some unsuccessful projects , then why was the project unsucessful ?
Why do you want to leave this company ? (Never say anything negative about your past company)
What are your negative points ? (Careful guy’s)
Do you work during late night’s ?.Best answer if there is project deadline yes.Do not show that it’s your culture to work during nights.
OOPS

(B) What is Object Oriented Programming ?
(B) What’s a Class ?
(B) What’s a Object ?
(A) What’s the relation between Classes and Objects ?
Can you explain different properties of Object Oriented Systems? Abstraction, Encapsulation, Polymorphism.
What’s difference between Association , Aggregation and Inheritance relationships?
(I) What are abstract classes ?
(B) What’s a Interface ?
(A) What is difference between abstract classes and interfaces? Following are the differences between abstract and interfaces :- √ Abstract classes can have concrete methods while interfaces have no methods implemented. √ Interfaces do not come in inheriting chain , while abstract classes come in inheritance.
(B) What is a delegate ? (B) What are event’s ? (I) Do events have return type ? (I) What’s difference between delegate and events?
(B) If we inherit a class do the private variables also get inherited ?
(B) What are different accessibility levels defined in .NET ?
(I) Can you prevent a class from overriding ?
(I) What’s the use of “MustInherit” keyword in VB.NET ?
(A) What are similarities between Class and structure ?
(B) What does virtual keyword mean ?
What's the logic of link list ?
(B) What is Dispose method in .NET ?
(A) What is Array List?
(A) What’s a Hash Table? Twist :- What’s difference between HashTable and ArrayList ?
(A) What are queues and stacks ?
(B) What is ENUM ?
(A)In a program there are multiple catch blocks so can it happen that two catch blocks are executed ?
(A) What is the difference between System.String and System.StringBuilder classes?
.Net FrameWork
(B)What is a IL? Twist :- What is MSIL or CIL , What is JIT?
(B)What is a CLR?
responsibilities of CLR
Garbage Collection, Code Access Security, Code Verification, IL( Intermediate language )-to-native translators and optimizer’s
(B)What is a CTS?
(B)What is a Managed Code? (B)What is a Assembly? GAC(A) What are different types of Assembly?
(A)If you want to view a Assembly how to you go about it ? Twist : What is ILDASM ?
(B) What is Difference between Namespace and Assembly?
(A) What is Manifest? Ans: √ Version of assembly √ Security identity √ Scope of the assembly √ resolve references to resources and classes.
(B)Where is version information stored of a assembly ?
(I)Is versioning applicable to private assemblies? (B) What is GAC ? Twist :- What are situations when you register .NET assembly in GAC ? (I) What is concept of strong names ? DLL hell.?
(B)What is garbage collection? (B)What is reflection? All .NET assemblies have metadata information stored about the types defined in modules.This metadata information can be accessed by mechanism called as “Reflection”.System.Reflection can be used to browse through the metadata information. Using reflection you can also dynamically invoke methods using System.Type.Invokemember.Below is sample source code if needed you can also get this code from CD provided , go to “Source code” folder in “Reflection Sample” folder. Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Pobjtype As Type Dim PobjObject As Object Dim PobjButtons As New Windows.Forms.Button() Pobjtype = PobjButtons.GetType() For Each PobjObject In Pobjtype.GetMembers LstDisplay.Items.Add(PobjObject.ToString()) Next End Sub End Class
(B) What are Value types and Reference types ? (B) What is concept of Boxing and Unboxing ?
Dim x As Integer Dim y As Object x = 10 ‘ boxing process y = x ‘ unboxing process x = y

(B)How do you start a project?
Reports
Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.



ASP.NET
What’s your favorite VB.NET or C#....Prepare a diplomatic answer.... Do not get in to arguments.
List the types of Authentication supported by ASP.NET.
• Windows (default)
• Forms
• Passport
• None (Security disabled)

(B) What’s the sequence in which ASP.NET events are processed ? √ Page_Init. √ Page_Load. √ Control events √ Page_Unload event.
(B) How can we identify that the Page is PostBack ? (B) How does ASP.NET maintain state in between subsequent request ? (A) What is event bubbling ?
(B) What’s the use of @ Register directives ?
(B) What is AppSetting Section in “Web.Config” file ?
(B) Where is ViewState information stored ?
(B) How can we create custom controls in ASP.NET ?
(B) How many types of validation controls are provided by ASP.NET ?
(B) Can you explain what is “AutoPostBack” feature in ASP.NET ?
(B) What’s the use of “GLOBAL.ASAX” file ?
(B) What’s the difference between “Web.config” and “Machine.Config” ?
(A) What’s difference between Server.Transfer and response.Redirect ?
(A)What’s difference between Authentication and authorization?
(B)What’s difference between Datagrid , Datalist and repeater ?
(A)From performance point of view how do they rate ?
(I) Do session use cookies ?
(B)How can we check if all the validation control are valid and proper ?
(A)What is Tracing in ASP.NET ? (A) How do we enable tracing ?
(B)How can we kill a user session ? (I)How do you upload a file in ASP.NET ? (I)How do I send email message from ASP.NET ? (B)Explain the differences between Server-side and Client-side code?
Mater Pages:-
Themes:-
What is a class in CSS?
What is web application virtual directory?
What are the collection classes?
Generics
What does connection string consist of?
ADO.NET
(B)What is the namespace in which .NET has the data functionality classes ? (B) Can you give a overview of ADO.NET architecture ? data provider :- Datareader ,
Data Adapter, Dataset, Connection.
DataView
(B)What is difference between dataset and datareader ?
what are the methods provided by the command object
(B) How do we connect to SQL SERVER , which namespace do we use ?

Add Items to dropdown ?lstData.Items.Add(objReader.Item(“FirstName”))
How do we use stored procedure in ADO.NET
How do we provide parameters to the stored procedures?
Which is the best place to store connectionstring in .NET projects ?
(B) What are steps involved to fill a dataset ?
(B)What are the various methods provided by the dataset object to generate XML?
√ ReadXML Read’s a XML document in to Dataset. √ GetXML This is function’s which return’s a string containing XML document. √ WriteXML This write’s a XML data to disk.
How can we save all data from dataset ?
(B) How can we add/remove row’s in “DataTable” object of “DataSet” ?
(B) How can we load multiple tables in a DataSet ?
(B) How can we add relation’s between table in a DataSet ?
Dim objRelation As DataRelation objRelation=New DataRelation("CustomerAddresses",objDataSet.Tables("Customer").Columns("Custid") ,objDataSet.Tables("Addresses").Columns("Custid_fk")) objDataSet.Relations.Add(objRelation)
(I)What’s difference between Dataset. clone and Dataset. copy ? Clone: - It only copies structure, does not copy data. Copy: - Copies both structure and data.
XML
51. Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.
51. Differences Between XML and HTML?
Anyone with a fundamental grasp of XML should be able describe some of the main differences outlined in the table below
XML HTML
User definable tags Defined set of tags designed for web display
Content driven Format driven
End tags required for well formed documents End tags not required
Quotes required around attributes values Quotes not required
Slash required in empty tags Slash not required

DTD
ELEMENT
1. What is the purpose of XSLT other than displaying XML contents in HTML?
2. How to refresh a static HTML page?
3. What is the difference between DELETE and TRUNCATE in SQL?
4. How to declare the XSLT document?
5. What are the data Islands in XML?
6. How to initialize COM in ASP?
7. What are the deferences of DataSet and ???
8. What are the cursers in ADO?
9. What are the in-build components in ASP?
10. What are the Objects in ASP?

Threading
(B)What is Multi-tasking ?
(B)What is Multi-threading ?
(I)Can we use events with threading ?yes

Remoting and Webservices
(B) What is .NET Remoting ?
(B) What is a WebService ?
Simple Object Access Protocol (SOAP)
(B) What is UDDI ?
(B) What is WSDL?
(B) What is file extension of Webservices ?
(B)Which attribute is used in order that the method can be used as WebService ?
Caching Concepts
(B) What is application object ?
(B) What are different types of caching using cache object of ASP.NET?
Page Output Caching,Page Fragment Caching
What are ASP.NET session
Which various modes of storing ASP.NET session? InProc:-, StateServer:, SQL SERVER:-
(A) Is Session_End event supported in all session modes ? Session_End event occurs only in “Inproc mode”.”State Server” and “SQL SERVER” do not have Session_End event.
A) Where do you specify session state mode in ASP.NET ?
B) (B) What are the other ways you can maintain state ?
C) (B) What is ViewState ?


SQL SERVER

What is normalization? What are different type of normalization?
(B) (B) What are different types of joins
(C) (I)What are indexes and What is the difference between clustered and nonclustered indexes?
(D) (A)How can you increase SQL performance ?
(E) (A)What is the use of OLAP ?
(F) (B)What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
(G) (B)What are the problems that can occur if you do not implement locking properly in SQL SERVER ?
(H) (B)What is the difference between a HAVING CLAUSE and a WHERE CLAUSE? You can use Having Clause with the GROUP BY function in a query and WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
(I) (B) What is difference between UNION and UNION ALL SQL syntax ?
(J) (I)What are different types of triggers in SQl SERVER 2000 ?
(K) (A)What is SQl injection ?

Monday, 29 November 2010

SELECT Combine Query

SELECT IC.InsCarrierId,IC.InsCarrierName,
ID.InterchangeControlId,ID.InterchangeName
FROM InsCarrier IC
LEFT OUTER JOIN InterchangeControl ID ON ID.InterchangeControlId=IC.InterchangeControlId
WHERE IC.InsCarrierName LIKE '%'+ @InsCarrierName + '%' --AND ID.InterchangeControlId=@InterchangeControlId

Monday, 18 October 2010

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, , >= or when the subquery is used as an expression.

i written the below query statement to sql server..

Collapse
SELECT ReferringPhysician.LastName,ReferringPhysician.FirstName,
(SELECT LocationName FROM RefPhysLocations WHERE ReferringPhysicianID = (SELECT ReferringPhysicianID FROM RefPhysLocations WHERE LocationName LIKE '%'+@keyword+'%')) AS LocationName
FROM ReferringPhysician
WHERE ReferringPhysician.ReferringPhysicianID=(SELECT ReferringPhysicianID FROM RefPhysLocations WHERE LocationName LIKE '%'+@keyword+'%')


But, i got the following error message from sql server.

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.