GeekInterview.com
Series: Subject:

SQL Server FAQs

Showing Questions 21 - 40 of 63 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

Can we send mail by SQLserver without using smtpserver in dot net?

Asked By: sbehera02 | Asked On: Jan 14th, 2007

Answered by: vishalparate on: Mar 30th, 2010

By using xp_sendmail store procedure we can do this but my problem is what parameter needs to be pass to this store procedure if I want to send mail from my local machine to another user, bcos&nb...

Sending mail

Asked By: sonudotnet | Asked On: Mar 17th, 2010

How to send mail from SQL server?

Answered by: vishalparate on: Mar 30th, 2010

With SQL Server 2005, there is no need to use MAPI client to send emails. Fellow developers who have used MAPI in the previous versions of SQL Server are well aware of the challenges it had. However i...

SQL server insert and delete

Asked By: srnsundari | Asked On: Dec 22nd, 2008

1. How to insert five rows in a table using single query(in ms-SQL or Oracle)2.How to delete duplicate values in a table. For example, the table containing five duplicate values(like name rani). I would like to delete all four rows in a table. But not the one row.

Answered by: psingla on: Mar 19th, 2010

As suggested by krishna create table test_a(a int)insert into test_a values(1)insert into test_a values(1)insert into test_a values(3)insert into test_a values(4)insert into test_a values(5)inser...

Answered by: clickfreehit on: Apr 11th, 2009

Inset data:

insert into targettable
select top 5 * from sourcetable

delete data:
1. select distinct * into targettable from sourcetable

2. delete from sourcetable

3. insert into sourcetable
    select * from targettable

No lock

Asked By: nasiriq | Asked On: May 25th, 2009

What is 'no lock' term in SQL, like "select * from table a (no lock)". What is its purpose?

Answered by: psingla on: Mar 19th, 2010

Define: By default select puts exclusive lock. Specifying no lock puts no lock on the table.
Advantage: Improve the peformance
Disadvantage: Dirty reads
Suggestion: Use in static table data (with fewer DML operations)

Answered by: sidhuonline on: Jun 30th, 2009

It is useful to improve the performance in executing the query. However there is a disadvantage in using it. The disadvantage is that one may not be sure that they are getting the data which is curren...

Can we call trigger inside stored procedure?

Asked By: yjagadeesh | Asked On: May 25th, 2007

Answered by: psingla on: Mar 19th, 2010

no.
Its automatically fired on DML statements.
these can not be triggered manually.

Answered by: srinu.tenali on: Dec 14th, 2007

no.because,stored procedures are explicity invoked and trigger is nothing but a stored procedure but fires an event or data modifications occur.trigger is a implicity invoked.

Call specific index in query

Asked By: wiinjeet | Asked On: Sep 8th, 2009

If a table has more than one index, how will you call a specific index in query?

Answered by: psingla on: Mar 19th, 2010

select * from table_name with (index(index_name))

Join same fields

Asked By: kadhar | Asked On: May 2nd, 2008

How to join same fields of four tables at SQL server?

Answered by: psingla on: Mar 19th, 2010

There are 5 types of join in sqlservercross joininner joinleft outer joinright outer joinfull outer joincross joinselect * from table1cross join table2cross join table3cross join table4inner joinselec...

Secure data

Asked By: arabam | Asked On: Oct 15th, 2009

How to secure data in the SQL server database?

Answered by: psingla on: Mar 9th, 2010

Revoke db_datareader and db_datawriter permission from the database.

Unsort query

Asked By: partha249 | Asked On: Jul 10th, 2009

How to write query to unsort while retrieving data?

Answered by: psingla on: Mar 9th, 2010

No need to do so.
the data  fetched by the sql query returns the unsorted data unless the order by clause is not used.

Suppose you create a students record with 5 marks, total and average.How to filter the top 3 students which are getting high average.

Asked By: P.Prabhakaran | Asked On: Sep 27th, 2007

Answered by: prathima on: Jul 25th, 2009

select top 5 avg(rank) from table_name group by rank order by rank desc

Answered by: cybersavvy on: Feb 19th, 2009

select top 3 * from students order by average desc

What are data objects?

Asked By: shraddha_13 | Asked On: Oct 1st, 2006

Answered by: yatinhatkar on: Jun 18th, 2009

Data objects are basic runtime entities.

Answered by: Rekha on: Jan 15th, 2007

Stored procedures,views,tables,database diagrams are the data objects

How to change rows into column and columns in to rows using SQL query in mssql?

Asked By: Vinay | Asked On: May 19th, 2007

Answered by: jjvetri on: May 8th, 2009

CREATE TABLE dbo.SalesByQuarter ( Y INT, Q INT, sales INT, PRIMARY KEY (Y,Q) ) GO INSERT dbo.SalesByQuarter(Y,Q,Sales) SELECT 2003, 2, 479000

Answered by: gvs on: Jan 3rd, 2008

Using Pivot Option in MS SQL Server 2005.

Insert bulk data

Asked By: jakkireddy | Asked On: Apr 8th, 2009

How to insert bulk data into the SQL server?

Answered by: clickfreehit on: Apr 11th, 2009

Table to table data transfer

select * into targettable from table
flat file to table data transfer
use bcp command
bcp pubs2..publishers in pub_out -c -t , -r r
 

Insert data in multiple tables

Asked By: rahulchd3112 | Asked On: Dec 28th, 2008

How to insert data in multiple tables at same time. Using SQL server 2000

Answered by: krishna8081 on: Feb 24th, 2009

Here is the example for you question.



USE
YourDB

GO

INSERT INTO
MyTable
(FirstCol,
SecondCol)

SELECT First
,1

UNION ALL

SELECT Second
,2

UNION ALL

SELECT Third
,3

UNION ALL

SELECT Fourth
,4

UNION ALL

SELECT Fifth
,5

GO


Answered by: swathi660 on: Jan 15th, 2009

insert into t1 values(,,,) insert into t2 values(,,,) insert into t3 values(,,,,)......try this ........

Unique key in SQL server

Asked By: smita_mushrif | Asked On: May 20th, 2008

How to define unique key in SQL server

Answered by: cybersavvy on: Feb 19th, 2009

CREATE TABLE product(pid INT PRIMARY KEY,pname VARCHAR(10),invoiceid INT UNIQUE)

Answered by: sivasangari_2006 on: Jan 30th, 2009

create table (field1 datatype contraint constraint-name constraint_type,fields2,field3.........)
(or)
alter table add constraint constraint constraint_name constraint_type(fieldname)

Eg:

create table emp(eno int constraint uni1 unique,ename varchar(20)

To display list of tables in database

Asked By: vijju31_1985 | Asked On: Feb 26th, 2008

How to display list of tables from a particular database in ms-sqlhow to display description of that particular table?

Answered by: cybersavvy on: Feb 19th, 2009

To Display list of tables in the database:
SELECT * FROM INFROMATION_SCHEMA.TABLES WHERE TYPE='basetable'

To describe the structure of a particular table
SP_HELP table_name;

Answered by: sivasangari_2006 on: Jan 30th, 2009

use
sp_help

It displays all the tables created in that database

Which index is created with primary key linear indexbinary indexclustered indexnon clustered index

Asked By: nidhigupta2000 | Asked On: May 19th, 2007

Answered by: cybersavvy on: Feb 19th, 2009

Clustered Index

Answered by: Badri on: Jun 18th, 2007

clustered index

I have three task in my ssis package,1. Script task2. Execute process task3. Ftp task I want to enable disable execute process task and ftp task on runtime using script task, how to do that?Do we have...

Asked By: Dhara3011 | Asked On: Mar 6th, 2007

Answered by: shreeprakashr on: Dec 11th, 2008

Hi,

In this case, We can disable the script task at the run time but we cannot disable succeeding tasks based on the variable. I tried and got to know this. Please correct me if i am wrong.

Regards
Shree

Answered by: gnanagopal on: Jun 19th, 2008

Hi Dhara,


1. create a variable
2. assign value for variable in the script task.
3. Use expression to enable or disable the taks based on the variable values.

let me know if you have any more details.


cheers,
gnanam.

Where can I get more information on SQL server cursors? Please help...

Asked By: sivaprasad_1982 | Asked On: Feb 5th, 2007

Answered by: pavalisofthard on: Oct 31st, 2008

Cursor is used to eliminate the repeated(duplicate) records in a table.

Answered by: anupama on: Feb 22nd, 2007

In Embedded SQl we can get

Stored procedure

Asked By: Raman4u | Asked On: Aug 7th, 2008

How we will access a table of one server from a stored procdure in other server?

Answered by: shaurya on: Oct 9th, 2008

You can access this through the following syntax

[Another Server IP].[Database Name].[Owner].[Table Name]

e.g.

[XXX.XXX.XX.XX].[myDB].[DBO].[EmployeeMaster]

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.