Вы находитесь на странице: 1из 18

Business Intelligence

Business Intelligence Development Studio is Microsoft Visual Studio 2008 with


additional project types that are specific to SQL Server business intelligence.
Business Intelligence Development Studio is the primary environment that you will
use to develop business solutions that include Analysis Services, Integration Services,
and Reporting Services projects. Each project type supplies templates for creating
the objects required for business intelligence solutions, and provides a variety of
designers, tools, and wizards to work with the objects.

Reporting service includes three core components

1. A set of tools that can be used to create manage and view reports

2. A report server component that host and processes reports in veriety of formats.

3. An API that allows you to integrate or extend data and report processing in
application or to create custom tools to build or manage reports.

Explain the architecture of SQL Reporting service.

Reporting Services runs as a middle-tier server, as part of your existing server architecture.

SQL Server 2000 should be installed for the database server, and Internet Information Services
6.0 as a Web server.

The report server engine takes in report definitions, locates the corresponding data, and produces
the reports.

Interaction with the engine can be done through the Web-based Report Manager, which also lets
you manage refresh schedules and notifications.

End users view the report in a Web browser, and can export it to PDF, XML, or Excel.

What are the Reporting Services components?

Reporting services components assist in development. These processing components include


some tools that are used to create, manage and view reports. A report designer is used to create
the reports. a report sever is used to execute and distribute reports. a report manager is used to
manage the report server.

What is Reporting Services?

SQL Server’s Reporting services offer a variety of interactive and printed reports managed by a
web interface. Reporting services is a server based environment.

How does the report manager work in SSRS?

Report manager is a web application. In SSRS it is accessed by a URL. The interface of this
Report manager depends on the permissions of the user. This means to access any functionality
or perform any task, the user must be assigned a role. A user with a role of full permissions can
entire all the features and menus of the report. To configure the report manager, a URL needs to
be defined.

What is an index?

Indexes of SQL Server are similar to the indexes in books. They help SQL Server retrieve the
data quicker. Indexes are of two types. Clustered indexes and non-clustered indexes. Rows in the
table are stored in the order of the clustered index key.
There can be only one clustered index per table.
Non-clustered indexes have their own storage separate from the table data storage.
Non-clustered indexes are stored as B-tree structures.
Leaf level nodes having the index key and its row locater

Define Clustered and Non-Clustered Index.

Clustered index exists as sorted row on disk.


Clustered index re-orders the table record.
Clustered index contains record in the leaf level of the B-tree.
There can be only one Clustered index possible in a table.

Non-clustered is the index in which logical order doesn’t match with physical order of stored data
on disk.
Non-clustered index contains index key to the table records in the leaf level.
There can be one or more Non-clustered indexes in a table.

Explain the difference between clustered and non-clustered index.

Answer
A clustered index reorders the way records are stored. A non clustered index is in which the
logical order of the index does not match the physical stored order of the rows on disk. A
clustered index is must faster because the index entries are actually data records. There can be
just one clustered index per table while there can be up to 249 non clustered indexes

Both stored as B-tree structure. The leaf level of a clustered index is the actual data where as leaf
level of a non-clustered index is pointer to data.

Explain the 'Fill factor' concept in Indexes.

The fill factor option is provided for smoothening index data storage and performance.

The percentage of space on each leaf level page to be filled with data is determined by the fill
factor value When an index is created. This reserves a percentage of free space for future growth

What is fill factor and pad index?

A fill factor is a specification done during the creation of indexes so that a particular amount of
space can be left on a leaf level page to decrease the occurrence of page splits when the data
has to be accommodated in the future.

A pad index specifies index padding. When it is set to ON, then the free space percentage per the
fill factor specification is applied to the intermediate-level pages of the index. When it is set to
OFF, the fill factor is not specified and enough space is left for a maximum size row that an index
can have
What is the difference between UNION and UNION ALL?

UNION selects only distinct values whereas UNION ALL selects all values and not just distinct
ones.

What is Log Shipping?

Log shipping defines the process for automatically taking back up of the database and transaction
files on a SQL Server and then restoring them on a standby/backup server. This keeps the two
SQL Server instances in sync with each other. In case production server fails, users simply need
to be pointed to the standby/backup server. Log shipping primarily consists of 3 operations:

Backup transaction logs of the Production server.


Copy these logs on the standby/backup server.
Restore the log on standby/backup server.

What is the difference between a Local and a Global temporary table?

Temporary tables are used to allow short term use of data in SQL Server. They are of 2 types:

Local

Only available to the current Db connection for current user and are cleared when connection is
closed.

Multiple users can’t share a local temporary table.

Global

Available to any connection once created. They are cleared when the last connection is closed.

Can be shared by multiple user sessions.

What is the STUFF and how does it differ from the REPLACE function?

Both STUFF and REPLACE are used to replace characters in a string.

STUFF function is used to insert a string into another string by deleting some characters
specified.

On the other hand, REPLACE instead of replacing specific characters, replaces existing
characters of all occurrences.

Select replace ('defdefdef','def','abc') results in abcabcabc


we cannot replace a specific occurrence of “def” using REPLACE.

Select stuff ('defdefdef', 4, 3,'abc') results in defabcdef

Describe the purposes and advantages stored procedure?

Stored procedures manage, control and validate data.


Large queries can be avoided.
Reduces network traffic since they need not be recompiled.
Even though the stored procedure itself may be a complex piece of code, we need not write it
over and over again. Hence stored procedures increases reusability of code
Permissions can be granted for stored procedures. Hence, increases security.

Define Truncate and Delete command

Truncate

Truncate command is used to remove all rows of the column.

The removed records are not recorded in the transaction log.

It is the fast way to remove all the records from the table.

The records once removed can’t be rolled back.

It can’t activate trigger.

It resets the identity of the column.

Delete

Delete command removes records one at a time and logs into the transaction log.
It can be used with or without where clause.
The records can be rolled back.
It activates trigger.
It doesn’t reset the identity of the column.

Define temporary and extended stored procedure.

Temporary Stored Procedure

• Temporary Stored Procedure is stored in TempDB database.


• It is volatile and is deleted once connection gets terminated or server is restarted.
• Temporary stored procedures are prefixed with pound sign #.
• One pound sign means that it is temporary within the session.
• Two pound signs ## means it is a global temporary procedure.
• Global temporary procedure can be called by any connection to the SQL server during its
lifetime.

Extended Stored Procedure

It is basically created to expand features of stored procedure.


It uses external program and compiles as DLL. Mostly xp_ prefix is used as naming convention
for extended stored procedure.

Define stored procedure.


Answer
Stored procedure is a set of SQL commands that have been complied and stored on the
database sever. They can be used in the code as and when required since hey stored. They
need not be complied over and over again. They can be invoked by CALL procedure (..) or
EXECUTE procedure(..)

What are the purposes and advantages stored procedure?

Answer
Purposes and advantages of stored procedures:

• Manage, control and validate data


• It can also be used for access mechanisms
• Large queries can be avoided
• Reduces network traffic since they need not be recompiled
• Even though the stored procedure itself may be a complex piece of code, we need not
write it over and over again. Hence stored procedures increases reusability of code
• Permissions can be granted for stored procedures. Hence, increases security.

What are the Lock Types?

SQL server supports following locks

Shared lock
Update lock
Exclusive lock

Shared lock

Shared Lock allows simultaneous access of record by multiple Select statements.


Shared Lock blocks record from updating and will remain in queue waiting while record is
accessed for reading.
If update process is going on then read command will have to wait until updating process finishes.

Update locks

This lock is used with the resources to be updated.

Exclusive locks

This kind of lock is used with data modification operations like update, insert or delete.

What are the lock types?

Main lock types:


• Shared: Applied to read only operations where the data is not modified. E.g.: Select
statements.
• Update: Applied to resources which can be updated. It resolves dead locks in case of
multiple sessions are reading, locking or updating resources later.
• Exclusive: Used for operations involving data modification. E.g.: Insert, Update, and
Delete. This ensures that multiple updates are not made to the same data at the same
time.
• Intent: Establishes a lock hierarchy. E.g.: Intent shared Intent exclusive and Shared with
intent exclusive.
• Schema: Used when schema dependent operations are being executed. E.g.: Schema
modification and Schema stability.
• Bulk update: Used while bulk copying of data and Tab lock is specified.

Having clause and Where clause

Having Clause: This clause is used for specifying a search condition for a group or an aggregate.
It can only be used with a SELECT statement. It’s often used with GROUP BY clause without
which its synonymous to a WHERE clause.

Where Clause: This clause is used to narrow down the dataset being dealt with following a
condition.

SELECT Id, Name, Age FROM Customers


WHERE Age>10

It is strongly recommended to use a Where clause with every Select Statement to avoid a table
scan and reduce the number of rows to be returned. It can be used with Select, Update, Delete
etc statements.

What is NOLOCK?

NOLOCK is used to improve concurrency in a system. Using NOLOCK hint, no locks are
acquired when data is being read. It is used in select statement. This results in dirty read -
another process could be updating the data at the exact time data is being read. This may result
in users seeing the records twice.

Transaction

A transaction is a set of operations that works as a single unit. The transactions can be categorized into
explicit, auto commit, and implicit transactions. Every transaction should follow four properties called the
ACID properties i.e. atomicity, consistency, isolation, and durability.

Atomicity
Transaction ensures either modification is committed or not committed.

Consistency
The data should be in consistent state when transaction process is completed. This means that
all related tables are updated.

Isolation
SQL server supports concurrency when mean that data can be access or shared by many users.
A transaction works in isolation and doesn’t allow other transaction to work concurrently on the
same piece of data.

Durability
Data is permanent once transaction is completed and it can be recovered even if system fails.

There are four transaction isolation levels:

Read uncommitted
Read committed
Repeatable read
Serializable

Read uncommitted isolation levels

This is the lowest isolation level which can also be called as dirty read. Using this, you can read
uncommitted data which can be rolled back at any point. With this level, SQL server uses share
lock while reading data.

Read committed isolation levels

With this level, uncommitted data can’t be read. This is default isolation level and uses shared
lock while reading data.

Repeatable read isolation levels

It locks all the data that is used in the query.

Serializable isolation levels

It locks data set until the transaction will be completed.

What are the Authentication Modes in SQL Server?

a. Windows Authentication Mode (Windows Authentication): uses user’s Windows account

b. Mixed Mode (Windows Authentication and SQL Server Authentication): uses either windows or
SQL server

Define @@Error and raise error.

Raise error is used to produce an error which is user defined or used to invoke an existing error
present in sys.messages. They are most commonly used in procedures when any condition fails
to meet.

Example:

SELECT COUNT (*) INTO: rows FROM student


WHERE studentid =: studentid;
IF: rows <> 0 THEN
RAISE ERROR 1 MESSAGE 'Student id exists in the "Student" table.';
ENDIF;

@@error is used to hold the number of an error. When a T-SQL statement is executed, @@error
value is set to 0 by the SQL server. If an error occurs, the number of that error is assigned as a
value.

Example: the value of @@error can be checked for “0” value to be safe.

Describe in brief Databases and SQL Server Databases Architecture.

Databases

• A database is a structured collection of data.


• Database can be thought as simple data file.
• It is more powerful than data file which stores data in organized way.

• Database organizes the data into a table. It is made up of several tables with rows and columns.

SQL Database Architecture

SQL database is divided into logical and physical components.

Logical Component

Logical components comprises of following:


Database objects,
Collation,
Login, Users, Roles and groups.

Physical component

Physically components exist as two or more files on disk.


Physically files can be of three types.

Primary data files


this is starting point of the database and contain pointer to point other files. Extension is mainly
.mdf.

Secondary data files


It consists of data other than primary data file. Extension is mainly .ndf.

Log files
It contains log information which is used to recover database.

Every SQL Server instance has primarily 4 system database i.e. master, model, tempdb and
msdb. All other databases are user created databases as per their needs and requirements.

A single SQL Server instance is capable of handling thousands of users working on multiple
databases.
What is transact-SQL? Describe its types?

Data Definition Language (DDL)


Data Control Language (DCL)
Data Manipulation Language (DML)

Types of Transact-SQL
SQL Server Provides three types of Transact-SQL statements namely DDL, DCL, and DML.

Data Definition Language (DDL)

It allows creating, altering and dropping database objects.

Data Control Language (DCL)

It is used to control access to data in the database.


It controls permission on the database objects using grant, revoke or deny statement.

Data Manipulation Language (DML)

It involves retrieval, insertion, deletion, modification in the database.


It includes select, insert, update, and delete command.

Define database objects.

Table

SQL Server database stores information in a two dimensional objects of rows and columns called table.

Data types

Data types specify the type of data that can be stored in a column.
Data types are used to apply data integrity to the column.
SQL Server supports many data type like character, varchar, integer, binary, decimal, money etc.

You can also create your own data type (User defined data type) using system data type.

Function

Microsoft SQL server allows you to create functions.


These functions are known as User Defined Functions.
It represents business logic using one or more transact SQL statements.
It can accept parameter(s) and can return scalar data value or a table data type.
It can be used in the SQL statement which is added advantage over stored procedure.

Index

Index can be thought as index of the book that is used for fast retrieval of information.
Index uses one or more column index keys and pointers to the record, to locate record.
Index is used to speed up query performance.
Kind of the indexes are clustered and non-clustered. Both exist as B-tree structure.
Clustered index exists as sorted row on disk.
Clustered index re-orders the table record.
Clustered index contains record in the leaf level of the B-tree.
There can be only one Clustered index possible in a table.

Non-clustered is the index in which logical order doesn’t match with physical order of stored data
on disk.
Non-clustered index contains index key to the table records in the leaf level.
There can be one or more Non-clustered indexes in a table.

Unique index is the index that is applied to any column of unique value.
A unique index can also be applied to a group of columns.

Constraint

Using Constraint, SQL Server enforces the integrity to the database.


It defines the rules that restrict unwanted data in the column.
Constraints can be table constraints or column constraints.

Primary Key Constraint


It is defined for one column or more columns that ensure data within these columns uniquely
identify each row of the table. Primary key column doesn’t allow null value. It doesn’t allow
duplicate data in the table.

Foreign Key Constraint


Foreign Key is to create link between two tables. It creates parent-child relationships. It ensures
that data from parent can be deleted only when there is no corresponding data in the child.

Unique Key Constraint


Unique key constraint is also like primary key except it allows null value to the column with unique
key constraints.

Check Key Constraint


It enforces domain integrity by restricting unwanted data to the column.

Rule

Rule is older version of check function. You can apply only one rule to the column. You should
first create rule using ‘Create Rule’ statement and then bind the rule to the column using
sp_bindrule system stored procedure.

Default

It ensures default value to the column if you do not specify a value to the column while inserting a
row.

Stored Procedures

A stored procedure is a compiled set of Transact-SQL statements.


The business logic can be encapsulated using stored procedure.
It improves network traffic by running set of Transact-SQL statements at one go.

Trigger
A trigger is a special type of event driven stored procedure.
It gets initiated when Insert, Delete or Update event occurs.
It can be used to maintain referential integrity.
A trigger can call stored procedure.

View

View can be created to retrieve data from one or more tables.


Query used to create view can include other views of the database.
We can also access remote data using distributed query in a view.

What is database replication?

The process of copying/moving data between databases on the same or different servers.

Snapshot replication,

Transactional replication,

Merge replication

What is the use of DBCC commands?

DBCC is database consistency checker. DBCC commands are used to check the consistency of
the databases.
DBCC CHECKDB - Ensures that tables and the indexes are correctly linked in the database.
DBCC CHECKALLOC - Ensures all pages are correctly allocated in the database.
DBCC SQLPERF - Provides report on current usage of transaction log in percentage.
DBCC CHECKFILEGROUP - Checks all tables file group for any damage

Define COLLATION.

Collation is the order that SQL Server uses for sorting or comparing textual data. There are three
types of sort order Dictionary case sensitive, Dictionary - case insensitive and Binary

Write SQL query to retrieve all tables of the database.

Select name from sysObjects where xtype=’u’

When do we use the UPDATE_STATISTICS command?

UPDATE_STATISTICS updates the indexes on the tables when there is large processing of data.
If we do a large amount of deletions any modification or Bulk Copy into the tables, we need to
basically update the indexes to take these changes into account

Define candidate key, alternate key, composite key.

A candidate key is one that can identify each row of a table uniquely.
Generally a candidate key becomes the primary key of the table. If the
table has more than one candidate key, one of them will become the
primary key, and the rest are called alternate keys.
A key formed by combining at least two or more columns is called
composite key.

What are defaults? Is there a column to which a default can't be bound?

A default is a value that will be used by a column, if no value is


supplied to that column while inserting data. IDENTITY columns and
timestamp columns can't have defaults bound to them. See CREATE
DEFUALT in books online

What is a deadlock and what is a live lock? How will you go about
resolving deadlocks?

Deadlock is a situation when two processes, each having a lock on one


piece of data, attempt to acquire a lock on the other's piece. Each
process would wait indefinitely for the other to release the lock,
unless one of the user processes is terminated. SQL Server detects
deadlocks and terminates one user's process.

A livelock is one, where a request for an exclusive lock is


repeatedly denied because a series of overlapping shared locks keeps
interfering. SQL Server detects the situation after four denials and
refuses further shared locks. A livelock also occurs when read
transactions monopolize a table or page, forcing a write transaction
to wait indefinitely.

What are cursors? Explain different types of cursors. What are the
disadvantages of cursors? How can you avoid cursors?

Cursors allow row-by-row prcessing of the resultsets.

Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See


books online for more information.

Disadvantages of cursors: Each time you fetch a row from the cursor,
it results in a network roundtrip, where as a normal SELECT query
makes only one rowundtrip, however large the resultset is. Cursors are
also costly because they require more resources and temporary storage
(results in more IO operations). Furthere, there are restrictions on
the SELECT statements that can be used with some types of cursors.

Most of the times, set based operations can be used instead of


cursors.

Different ways of moving data from databases


There are different methods of moving data

(1)BACKUP and RESTORE


(2)detaching

(3)Attaching databases

(4)Replication

(5) DTS

(6)BCP

(7)logshipping

(8) INSERT...SELECT

(9)SELECT...INTO

(10) creating INSERT scripts to generate data.

What do u mean by Extents and types of Extends

An Extent is a collection of 8 sequential pages to hold database from becoming fregmented. Fragment
means these pages relates to same table of database these also holds in indexing. To avoid for
fragmentation Sql Server assign space to table in extents. So that the Sql Server keep upto date data in
extents. Because these pages are continously one after another. There are usually two types of extends:-
Uniform and Mixed. Uniform means when extent is own by
a single object means all collection of 8 ages hold by a single extend is called uniform. Mixed mean when
more then one object is comes in extents is known as mixed extents.

SSRS Questions

Explain the architecture of reporting services.

Reporting services architecture is comprises of integrated components. It is multi-tiered, included


with application, server and data layers. This architecture is scalable and modular. A single
installation can be used across multiple computers. It includes the following components:

- Report Manager, Reporting Designer, Browser Types Supported by Reporting services, Report
server, Report server command line utilities, Report Server Database, Reporting Services
Extensibility, Data sources that is supported by Reporting Services.

Describe Reporting Lifecycle.

The Reporting Lifecycle includes

- Report designing – The designing is done in Visual Studio Report Designer. It generates a class
which embodies the Report Definition.

- Report processing – The processing includes bringing the report definition with data from the
report data source. It performs on all grouping, sorting and filtering calculations. The expressions
are evaluated except the page header, footer and section items. Later it fires the Binding event
and Bound event. As a result of the processing, it produces Report Instance. Report instance
may be persisted and stored which can be rendered at a later point of time.

- Report Rendering: Report rendering starts by passing the Report Instance to a specific
rendering extension (HTML or PDF formats). The instance of reports is paged if paging supported
by output format. The expressions of items are evaluated in the page header and footer sections
for every page. As a final step, the report is rendered to the specific output document.

Business Intelligence

Business Intelligence Development Studio is Microsoft Visual Studio 2008 with


additional project types that are specific to SQL Server business intelligence.
Business Intelligence Development Studio is the primary environment that you will
use to develop business solutions that include Analysis Services, Integration Services,
and Reporting Services projects. Each project type supplies templates for creating
the objects required for business intelligence solutions, and provides a variety of
designers, tools, and wizards to work with the objects.

Reporting service includes three core components

1. A set of tools that can be used to create manage and view reports

2. A report server component that host and processes reports in veriety of formats.

3. An API that allows you to integrate or extend data and report processing in application
or to create custom tools to build or manage reports.

Explain the architecture of SQL Reporting service.

Reporting Services runs as a middle-tier server, as part of your existing server architecture.

SQL Server 2000 should be installed for the database server, and Internet Information Services
6.0 as a Web server.

The report server engine takes in report definitions, locates the corresponding data, and produces
the reports.

Interaction with the engine can be done through the Web-based Report Manager, which also lets
you manage refresh schedules and notifications.

End users view the report in a Web browser, and can export it to PDF, XML, or Excel.

What are the Reporting Services components?

Reporting services components assist in development. These processing components include


some tools that are used to create, manage and view reports. A report designer is used to create
the reports. a report sever is used to execute and distribute reports. a report manager is used to
manage the report server.

What is Reporting Services?


SQL Server’s Reporting services offer a variety of interactive and printed reports managed by a
web interface. Reporting services is a server based environment.

How does the report manager work in SSRS?

Report manager is a web application. In SSRS it is accessed by a URL. The interface of this
Report manager depends on the permissions of the user. This means to access any functionality
or perform any task, the user must be assigned a role. A user with a role of full permissions can
entire all the features and menus of the report. To configure the report manager, a URL needs to
be defined.

Replication

Replication is a set of technologies for copying and distributing data and database
objects from one database to another and then synchronizing between databases to
maintain consistency. Using replication, you can distribute data to different locations
and to remote or mobile users over local and wide area networks, dial-up
connections, wireless connections, and the Internet.

Snapshot Replication
Snapshot replication simply takes a "snapshot" of the data on one server and moves that data to
another server (or another database on the same server). After the initial synchronization
snapshot, replication can refresh data in published tables periodically—based on the schedule
you specify. Although snapshot replication is the easiest type to set up and maintain, it requires
copying all data each time a table is refreshed.

Between scheduled refreshes, data on the publisher might be very different from the data on
subscriber. In short, snapshot replication isn't very different from emptying out the destination
table(s) and using a DTS package to import data from the source.

Transactional Replication
Transactional replication involves copying data from the publisher to the subscriber(s) once and
then delivering transactions to the subscriber(s) as they occur on the publisher. The initial copy of
the data is transported by using the same mechanism as with snapshot replication: SQL Server
takes a snapshot of data on the publisher and moves it to the subscriber(s). As database users
insert, update, or delete records on the publisher, transactions are forwarded to the subscriber(s).

To make sure that SQL Server synchronizes your transactions as quickly as possible, you can
make a simple configuration change: Tell it to deliver transactions continuously. Alternatively, you
can run synchronization tasks periodically. Transactional replication is most useful in
environments that have a dependable dedicated network line between database servers
participating in replication. Typically, database servers subscribing to transactional publications
do not modify data; they use data strictly for read-only purposes. However, SQL Server does
support transactional replication that allows data changes on subscribers as well.

Merge Replication
Merge replication combines data from multiple sources into a single central database. Much like
transactional replication, merge replication uses initial synchronization by taking the snapshot of
data on the publisher and moving it to subscribers. Unlike transactional replication, merge
replication allows changes of the same data on publishers and subscribers, even when
subscribers are not connected to the network. When subscribers connect to the network,
replication will detect and combine changes from all subscribers and change data on the
publisher accordingly. Merge replication is useful when you have a need to modify data on
remote computers and when subscribers are not guaranteed to have a continuous connection to
the network.

Full Recovery Model

The Full Recovery Model is the most resistant to data loss of all the recovery models.
The Full Recovery Model makes full use of the transaction log – all database operations
are written to the transaction log. This includes all DML statements, but also whenever
BCP or bulk insert is used.

For heavy OLTP databases, there is overhead associated with logging all of the
transactions, and the transaction log must be continually backed up to prevent it from
getting too large.

Benefits:

• Most resistant to data loss


• Most flexible recovery options - including point in time recovery

Disadvantages:

• Can take up a lot of disk space


• Requires database administrator time and patience to be used
properly

Bulk-Logged Recovery Model

The Bulk-Logged Recovery Model differs from the Full Recovery Model in that rows
that are inserted during bulk operations aren’t logged – yet a full restore is still possible
because the extents that have been changed are tracked.

The following transactions are minimally logged in a Bulk-Logged Recovery Model:

• SELECT INTO
• bcp and BULK INSERT
• CREATE INDEX
• Text and Image operations

Benefits:

• Transaction log stays small


• Easier from an administration standpoint (don’t have to worry about transaction
logs)

Disadvantages:

• Not for production systems


• Point in time recovery not possible
• Least data resistant recovery model

Simple Recovery Model

The simple recovery model is the most open to data loss. The transaction log can’t be
backed up and is automatically truncated at checkpoints. This potential loss of data is
makes the simple recovery model a poor choice for production databases. This option can
take up less disk space since the transaction log is constantly truncated.

Benefits:

• Transaction log stays small


• Easier from an administration standpoint (don’t have to worry
about transaction logs)

Disadvantages:

• Not for production systems


• Point in time recovery not possible
• Least data resistant recovery model

Subscription Overview
A subscription is a standing request to deliver a report at a specific time or in
response to an event, and then to have that report presented in a way that you
define.

subscriptions can be used to schedule and then automate the delivery of a report.

Standard and Data-Driven Subscriptions


Reporting Services supports two kinds of subscriptions: standard and data-driven.
Standard subscriptions are created and managed by individual users. A standard
subscription consists of static values that cannot be varied during subscription
processing. For each standard subscription, there is exactly one set of report
presentation options, delivery options, and report parameters.
Data-driven subscriptions are dynamic in that the presentation, delivery, and
parameter values are retrieved at run time from a data source. You might use data-
driven subscriptions if you have a very large recipient list or if you want to vary
report output for each recipient. To use data-driven subscriptions, you must have
expertise in building queries and an understanding of how parameters are used.
Report server administrators typically create and manage these subscriptions. For
more information, see Data-Driven Subscriptions.

E-Mail, File Share, and Custom Delivery


Subscriptions use delivery extensions to determine how to distribute a report and in
what format. When a user creates a subscription, he or she can choose one of the
available delivery extensions to determine how the report is delivered. Reporting
Services includes support for e-mail delivery and delivery to a file share.

select convert(nvarchar(100),dateadd(dd,-
datepart(dd,getdate()),getdate()),102)

select dateadd(dd,-datepart(dd,getdate()),getdate())