Sep 23, 2015

Some Tricky SQL Queries

Hi,

select count(*) -- // 1 

select 15 -- // 15

select $   -- // 0.00 

select count('7') -- // 1 

select 'RAJ'+1 -- // Conversion Problem Error

select 'RAJ'+'1' -- // RAJ1

select (select 'RAJ') -- // RAJ

select select 'RAJ' -- // Error

select * from 'RAJ' -- // Error

select * from AccountDetials,ACTSBankDetails -- // o/p will be cross join of both tables

select count(*) + count(*) -- // 2

select 'Rajkumar Palnati HDFC' from AccountDetials -- // 'Rajkumar Palnati HDFC'

select sum(1+2*3) --// 7

select max(1+2*3) -- // 7

select max(1,2,3) -- //  Error, The max function requires 1 argument(s)

select max('RAJ') -- // RAJ

select count(select Client from AccountDetials) -- // Error syntax 


Thanks & Regards
Rajkumar Palnati

Sep 12, 2015

Dynamic Query in Stored Procedure with parameter as a single field

Hi,

In Sql Server Stored Procedure we can create dynamic queries with single or multiple parameters

Here i am passing i/p parameter as table for dynamic query

Example :

CREATE procedure sp_RetrieveBasedOnField
@TableName varchar(50) -- i/p 
as
begin
declare @Query as nvarchar(255)
set @Query=N'select * from '+ @TableName +N''
exec sp_ExecuteSQL @Query
end


This is simple as we can pass our table name and executes dynamic query.

Thank you


Differences between Functions and Stored Procedures in Sql Server

Hi,


1) Procedure can return zero or n values whereas function can return one value which is mandatory

2) Procedures can have input, output parameters for it whereas functions can have only input parameters

3) Procedure allows select as well as DML(
INSERT/UPDATE/DELETE) statements in it whereas function allows only select statement in it

4) Functions can be called from procedure whereas procedures cannot be called from function

5) Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function

6) We can go for transaction management in procedure whereas we can't go in function

7) Procedures cannot be utilized in a select statement whereas function can be embedded in a select statement.

Thanks & Regards
RAJ

ADO.NET Object Model

Hi,

ADO.NET is designed to help developers work efficiently with multi tier databases, across intranet or Internet scenarios.

The ADO.NET object model consists of two key components as follows:


1. Connected model 2. Disconnected model



  • Connected model (.NET Data Provider - a set of components including the Connection, Command, DataReader, and DataAdapter objects)
  • Disconnected model (DataSet).

For better please go through these links about ADO.Net objects.





What is ASP.NET Application file or What is the use of Global.asax file events in asp.net ?

Hi,

Please go through this link very clear information about ASP.NET Application file
or Global Application File.

http://www.aspdotnet-suresh.com/2011/05/what-is-use-of-globalasax-file-in.html


Thank you

Sep 11, 2015

What is the difference b/w Debug and Trace ?


  • Tracing is the process of collecting information about the program's execution.
  • Debugging is the process of finding and fixing errors(bugs) in the program.
  • Tracing is the ability of an application to generate information about its own execution.
  • Tracing and Debugging works in a similar way, but the difference is that tracing from the 'Debug' class only works in builds with DEBUG symbol, whereas tracing from the 'Trace' class only works in builds with TRACE symbol.
  • The NameSpace, System.Diagnostics.Trace.Writeline for tracing that you want to work in debug and release builds.
  • The NameSpace, System.Diagnostics.Debug.Writeline for tracing that you want to work in debug builds only.

Sep 10, 2015

Some Important FAQ's .Net

Hi,

I would like to share some of the FAQ's in .Net

Please find the following Images