Showing posts with label explain. Show all posts
Showing posts with label explain. Show all posts

Thursday, March 29, 2012

Difference between STDEV & STDEVP

Can somebody please compare these 2 functions for me and explain with an example?

Thank You

You can find detailed description here (the second article has an example):

http://office.microsoft.com/en-us/assistance/HP010322691033.aspx

http://www.beyondtechnology.com/tips016.shtml

Quote:

STDEV is used when the group of numbers being evaluated are only a partial sampling of the whole population. The denominator for dividing the sum of squared deviations is N-1, where N is the number of observations ( a count of items in the data set ). Technically, subtracting the 1 is referred to as "non-biased."
STDEVP is used when the group of numbers being evaluated is complete - it's the entire population of values. In this case, the 1 is NOT subtracted and the denominator for dividing the sum of squared deviations is simply N itself, the number of observations ( a count of items in the data set ). Technically, this is referred to as "biased." Remembering that the P in STDEVP stands for "population" may be helpful. Since the data set is not a mere sample, but constituted of ALL the actual values, this standard deviation function can return a more precise result.

Tuesday, March 27, 2012

Difference Between Query Parameters and Report Parameters

Hi Guys,
Can somebody explain me cleraly the difference between Query and Report
Parameters.
Report Parameters r automatically created when u put some variable in a
query.
2)
One more thing is there a way we can hide query string in the IE as I dont
want the users to see the report URL.
3)
My Stored Proc expects 2 parameters but I dont want to pass them in the URL
string is there any other way I can pass parameters to the report from the
front end other than URL strings
Many Many Thanks
Chandra
--
Message posted via http://www.sqlmonster.comwell report parameters r used to get input from the user for the report
and report parameters got attached with query parameters to pass on
input from the user to query in order to build query at run time when u
define query parameter in ur query report automatically generates a
report parameter and attach that report parameter to the specific query
parameter to see further details click EDIT DATASET option n click
parameters tab u ll c how report parameters r getting associated to
query parameters
as far as ur question of hiding parameters is concerned u got to use
reporting services class (SOAP API) n make ur own application to access
the reports instead of accessing reports through URL or u got to set
any property of Ineternet explorers in the registery to hide the
address bar and status bar as well
hope this answers
take care
regards|||Go here:
http://msdn.microsoft.com/library/en-us/RSCREATE/htm/rcr_creating_interactive_v1_50fn.asp?frame=true
It will tell you all you need to know about parameters.
"Chandra Kotha via SQLMonster.com" wrote:
> Hi Guys,
> Can somebody explain me cleraly the difference between Query and Report
> Parameters.
> Report Parameters r automatically created when u put some variable in a
> query.
> 2)
> One more thing is there a way we can hide query string in the IE as I dont
> want the users to see the report URL.
> 3)
> My Stored Proc expects 2 parameters but I dont want to pass them in the URL
> string is there any other way I can pass parameters to the report from the
> front end other than URL strings
> Many Many Thanks
> Chandra
> --
> Message posted via http://www.sqlmonster.com
>|||Others have answered most of your questions. Just a little bit more about
query parameters versus report parameters. RS does automatically create a
report parameter when you put in a query parameter. However, you do not have
to use it. You can set the query parameter to a different report parameter,
you can set it to an expression (which means that if you want you can first
have some custom code massage the report parameter first). A very common
scenario where there is not a one to one relationship between report and
query parameters is when you have several datasets in a report. Let's say I
have several datasets that all use a fromdate and todate. I sure don't want
the user to have to put in the same date multiple times. So, I delete the
extra report parameters and have all the datasets query parameters point to
the same set of report parameters.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Chandra Kotha via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:698d0fc48f2b42f69c5c9fdc8632204a@.SQLMonster.com...
> Hi Guys,
> Can somebody explain me cleraly the difference between Query and Report
> Parameters.
> Report Parameters r automatically created when u put some variable in a
> query.
> 2)
> One more thing is there a way we can hide query string in the IE as I dont
> want the users to see the report URL.
> 3)
> My Stored Proc expects 2 parameters but I dont want to pass them in the
URL
> string is there any other way I can pass parameters to the report from the
> front end other than URL strings
> Many Many Thanks
> Chandra
> --
> Message posted via http://www.sqlmonster.com|||Thanks Guys for ur responses
--
Message posted via http://www.sqlmonster.com

Difference Between primary key and unique key

Hi,
Can somebody explain me the difference between primary key
and unique key and in which scenarios we use them. please
explain with a example.
Regards
ChipThe primary distinction is that Primary key column(s) must be non-nullable
while Unique constraints allow a NULL value. Also, there can be only one
primary key in a table while there can be more than one Unique constraints
defined for a table.
--
Anith|||Hi,
Primary key :
- The key which will not allow any NULL Values.
- Will Create a Clustered Index by default.
Unique Key
- The Key will allow 1 Null Value
- Will Create a non clustered index by default
Since Primary key will not allow NULLS values it can be used in scenario to
preserve more data integrity
Thanks
Hari
MCDBA
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:12c4c01c3f6a9$9ac762d0$a401280a@.phx.gbl...
> Hi,
> Can somebody explain me the difference between primary key
> and unique key and in which scenarios we use them. please
> explain with a example.
> Regards
> Chipsql

Difference Between primary key and unique key

Hi,
Can somebody explain me the difference between primary key
and unique key and in which scenarios we use them. please
explain with a example.
Regards
ChipThe primary distinction is that Primary key column(s) must be non-nullable
while Unique constraints allow a NULL value. Also, there can be only one
primary key in a table while there can be more than one Unique constraints
defined for a table.
Anith|||Hi,
Primary key :
- The key which will not allow any NULL Values.
- Will Create a Clustered Index by default.
Unique Key
- The Key will allow 1 Null Value
- Will Create a non clustered index by default
Since Primary key will not allow NULLS values it can be used in scenario to
preserve more data integrity
Thanks
Hari
MCDBA
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:12c4c01c3f6a9$9ac762d0$a401280a@.phx
.gbl...
> Hi,
> Can somebody explain me the difference between primary key
> and unique key and in which scenarios we use them. please
> explain with a example.
> Regards
> Chip

Difference between nvarchar(4000) and nvarchar(3999) in SQL Server

Hi
Can anybody explain why this select returns different results in SQL 200 and
SQL 2005?
=========
if exists (select * from sysobjects where name = 'test') begin
drop table test
end
GO
if exists(select * from sysobjects where name = 'vw') begin
drop view vw
end
GO
create table test (a int, b int)
GO
create view vw as select * from test
GO
declare @.s nvarchar(4000) set @.s = ' select '
select @.s = @.s + cast(',
'+ cast(c.name as nvarchar(100))+ ' ' + cast(REPLACE(c.name ,'CM_','')
as nvarchar(100)) as nvarchar(4000))
from syscolumns c join sysobjects o on c.id = o.id
where o.name = 'vw'
order by c.colid
print @.s
===========
and if you change nvarchar(4000) to nvarchar(3999) it returns the same on
both 2000 and 2005?
==========
if exists (select * from sysobjects where name = 'test') begin
drop table test
end
GO
if exists(select * from sysobjects where name = 'vw') begin
drop view vw
end
GO
create table test (a int, b int)
GO
create view vw as select * from test
GO
declare @.s nvarchar(4000) set @.s = ' select '
select @.s = @.s + cast(',
'+ cast(c.name as nvarchar(100))+ ' ' + cast(REPLACE(c.name ,'CM_','')
as nvarchar(100)) as nvarchar(3999))
from syscolumns c join sysobjects o on c.id = o.id
where o.name = 'vw'
order by c.colid
print @.sYurity, what do you mean?
Both queries return the same result for me on both platforms. I see no
difference (on either platform) between the 3999 varchar and 4000
varchar version.
The result I get is:
select ,
a a,
b b
However, if the you select from a table with @.localvar = @.localvar +
<some column>, and the selection includes more than one row, then the
result is undefined.
Apart from the result listed above, SQL Server might easily return
select ,
b b,
a a
or even
select ,
a a,
a a,
b b,
b b
In other words: I wouldn't use it.
Gert-Jan
Yuriy wrote:
> Hi
> Can anybody explain why this select returns different results in SQL 200 a
nd
> SQL 2005?
> =========
> if exists (select * from sysobjects where name = 'test') begin
> drop table test
> end
> GO
> if exists(select * from sysobjects where name = 'vw') begin
> drop view vw
> end
> GO
> create table test (a int, b int)
> GO
> create view vw as select * from test
> GO
> declare @.s nvarchar(4000) set @.s = ' select '
> select @.s = @.s + cast(',
> '+ cast(c.name as nvarchar(100))+ ' ' + cast(REPLACE(c.name ,'CM_',''
)
> as nvarchar(100)) as nvarchar(4000))
> from syscolumns c join sysobjects o on c.id = o.id
> where o.name = 'vw'
> order by c.colid
> print @.s
> ===========
> and if you change nvarchar(4000) to nvarchar(3999) it returns the same on
> both 2000 and 2005?
> ==========
> if exists (select * from sysobjects where name = 'test') begin
> drop table test
> end
> GO
> if exists(select * from sysobjects where name = 'vw') begin
> drop view vw
> end
> GO
> create table test (a int, b int)
> GO
> create view vw as select * from test
> GO
> declare @.s nvarchar(4000) set @.s = ' select '
> select @.s = @.s + cast(',
> '+ cast(c.name as nvarchar(100))+ ' ' + cast(REPLACE(c.name ,'CM_',''
)
> as nvarchar(100)) as nvarchar(3999))
> from syscolumns c join sysobjects o on c.id = o.id
> where o.name = 'vw'
> order by c.colid
> print @.s|||Hi
Under SQL server 2005 I get
select ,
b b
(note that "a a" is absent)
in case of 4000 and I get correct result
select ,
a a,
b b
in case of 3999.
Can anyone else reproduce my problem?
Meanwhile, I do not agree with you about unspecified case, because there
is "order by" specifying the order.
Yuriy
> Yurity, what do you mean?
> Both queries return the same result for me on both platforms. I see no
> difference (on either platform) between the 3999 varchar and 4000
> varchar version.
> The result I get is:
> select ,
> a a,
> b b
> However, if the you select from a table with @.localvar = @.localvar +
> <some column>, and the selection includes more than one row, then the
> result is undefined.
> Apart from the result listed above, SQL Server might easily return
> select ,
> b b,
> a a
> or even
> select ,
> a a,
> a a,
> b b,
> b b
> In other words: I wouldn't use it.
> Gert-Jan
> Yuriy wrote:
>|||It is interesting that changing nvarchar(4000) to nvarchar(3999) changes
execution plan. Can you post your execution plan of the select stement here
?
Thank you
> Yurity, what do you mean?
> Both queries return the same result for me on both platforms. I see no
> difference (on either platform) between the 3999 varchar and 4000
> varchar version.
> The result I get is:
> select ,
> a a,
> b b
> However, if the you select from a table with @.localvar = @.localvar +
> <some column>, and the selection includes more than one row, then the
> result is undefined.
> Apart from the result listed above, SQL Server might easily return
> select ,
> b b,
> a a
> or even
> select ,
> a a,
> a a,
> b b,
> b b
> In other words: I wouldn't use it.
> Gert-Jan
> Yuriy wrote:
>|||Hello, Yuriy
I was able to reproduce the problem you mentioned, on SQL Server 2005
Express Edition (9.00.1399), in any database other than master.
However, in the master database, it gives the expected results. It's
not clear to me (yet) what is the difference that makes SQL Server to
execute the query in the usual way in the master database, but not in
the other databases.
However, the result of such a query is undefined, as documented by KB
Article 287515:
"The correct behavior for an aggregate concatenation query is
undefined."
If you insist on using aggregate concatenation, my suggestion is to use
it on a single table (not using any JOIN-s) and not to use any other
expressions (either in the SELECT clause or in the ORDER BY clause).
For example:
[...]
declare @.t TABLE (colid smallint PRIMARY KEY, x nvarchar(4000))
insert into @.t
select colid, cast(',
'+ cast(c.name as nvarchar(100))+ ' ' + cast(REPLACE(c.name
,'CM_','')
as nvarchar(100)) as nvarchar(4000))
from syscolumns c join sysobjects o on c.id = o.id
where o.name = 'vw'
order by c.colid
declare @.s nvarchar(4000) set @.s = ' select '
select @.s = @.s + x FROM @.t order by colid
[...]
Razvan|||Agree with you. Just faced with lots of code which uses the fact that under
SQL 2000 it usually works fine.
Thank you

> Hello, Yuriy
> I was able to reproduce the problem you mentioned, on SQL Server 2005
> Express Edition (9.00.1399), in any database other than master.
> However, in the master database, it gives the expected results. It's
> not clear to me (yet) what is the difference that makes SQL Server to
> execute the query in the usual way in the master database, but not in
> the other databases.
> However, the result of such a query is undefined, as documented by KB
> Article 287515:
> "The correct behavior for an aggregate concatenation query is
> undefined."
> If you insist on using aggregate concatenation, my suggestion is to
> use it on a single table (not using any JOIN-s) and not to use any
> other expressions (either in the SELECT clause or in the ORDER BY
> clause). For example:
> [...]
> declare @.t TABLE (colid smallint PRIMARY KEY, x nvarchar(4000))
> insert into @.t
> select colid, cast(',
> '+ cast(c.name as nvarchar(100))+ ' ' + cast(REPLACE(c.name
> ,'CM_','')
> as nvarchar(100)) as nvarchar(4000))
> from syscolumns c join sysobjects o on c.id = o.id
> where o.name = 'vw'
> order by c.colid
> declare @.s nvarchar(4000) set @.s = ' select '
> select @.s = @.s + x FROM @.t order by colid [...]
> Razvan
>|||Yes, that must be a real disappointment. I would never have guessed that
the latest version of SQL Server would only use the last row...
Maybe it is an option to lower the compatibility level. Maybe if you run
in "SQL 2000" mode the behavior is the same on SQL 2005.
Gert-Jan
Yuriy Solodkyy wrote:
> Agree with you. Just faced with lots of code which uses the fact that und
er
> SQL 2000 it usually works fine.
> Thank you
>|||It was initially found in level 8 DB. Option (fast 1) helps in this case,
but anyway it is necessary to stop using such selects. Meanwhile, the same
code is promoted by Ken Handerson's book "The Guru's Guide to Transact-SQL".
> Yes, that must be a real disappointment. I would never have guessed
> that the latest version of SQL Server would only use the last row...
> Maybe it is an option to lower the compatibility level. Maybe if you
> run in "SQL 2000" mode the behavior is the same on SQL 2005.
> Gert-Jan
> Yuriy Solodkyy wrote:
>

Difference between NORECOVERY and NO_TRUNCATE

Hi
Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
with options for BACKUP LOG statement.NO_TRUNCATE
Specifies that the log not be truncated and causes the Database Engine to
attempt the backup regardless of the state of the database. Consequently, a
backup taken with NO_TRUNCATE might have incomplete metadata. This option
allows backing up the log in situations where the database is damaged.
NORECOVERY
Backs up the tail of the log and leaves the database in the RESTORING state.
NORECOVERY is useful when failing over to a secondary database or when
saving the tail of the log before a RESTORE operation.
For more info about BACKUP command go to the following link:
http://msdn2.microsoft.com/en-us/library/ms186865.aspx
Ekrem ?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
> Hi
> Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
> with options for BACKUP LOG statement.
>|||Hi Ekrem,
Can you please explain the difference with an example.
"Ekrem ?nsoy" wrote:

> NO_TRUNCATE
> Specifies that the log not be truncated and causes the Database Engine to
> attempt the backup regardless of the state of the database. Consequently,
a
> backup taken with NO_TRUNCATE might have incomplete metadata. This option
> allows backing up the log in situations where the database is damaged.
> NORECOVERY
> Backs up the tail of the log and leaves the database in the RESTORING stat
e.
> NORECOVERY is useful when failing over to a secondary database or when
> saving the tail of the log before a RESTORE operation.
> For more info about BACKUP command go to the following link:
> http://msdn2.microsoft.com/en-us/library/ms186865.aspx
> --
> Ekrem ?nsoy
>
> "Balaji" <Balaji@.discussions.microsoft.com> wrote in message
> news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
>|||There are three ways of Recovery State:
1-RECOVERY
2-NORECOVERY
3-STANDBY
If you restore your database in recovery, then your database will be online
and your users will be able to perform any operation against it.
If you restore your database in NORECOVERY then your users will not be able
to query your database.
If you restore your database in STANDBY then your users will be able to use
only SELECT against it.
Every recovery state has a purpose. You should read about this from BOL for
more information.
For example NORECOVERY and STANDBY states are being used in Log Shipping. If
you use NORECOVERY for your Log Shipping solution then your users will not
be able to query against the database on your secondary server. If you
restore your secondary database then your users will be able to query (only
SELECT) against it however your users will be disconnected each time for the
new transactions to be applied to the secondary database.
Example for no_truncate:
BACKUP LOG AdventureWorks TO DISK = N'C:\test\tiesto.bak' WITH NO_TRUNCATE
This hint is used for inaccessible database. Tibor has an article about
this, you can read it for more info:
http://www.karaszi.com/SQLServer/in...no_truncate.asp
Ekrem ?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:AFC8BD66-6474-4837-A80A-B9D3FF0068E3@.microsoft.com...[vbcol=seagreen]
> Hi Ekrem,
> Can you please explain the difference with an example.
> "Ekrem ?nsoy" wrote:
>

Difference between NORECOVERY and NO_TRUNCATE

Hi
Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
with options for BACKUP LOG statement.NO_TRUNCATE
Specifies that the log not be truncated and causes the Database Engine to
attempt the backup regardless of the state of the database. Consequently, a
backup taken with NO_TRUNCATE might have incomplete metadata. This option
allows backing up the log in situations where the database is damaged.
NORECOVERY
Backs up the tail of the log and leaves the database in the RESTORING state.
NORECOVERY is useful when failing over to a secondary database or when
saving the tail of the log before a RESTORE operation.
For more info about BACKUP command go to the following link:
http://msdn2.microsoft.com/en-us/library/ms186865.aspx
--
Ekrem Ã?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
> Hi
> Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
> with options for BACKUP LOG statement.
>|||Hi Ekrem,
Can you please explain the difference with an example.
"Ekrem Ã?nsoy" wrote:
> NO_TRUNCATE
> Specifies that the log not be truncated and causes the Database Engine to
> attempt the backup regardless of the state of the database. Consequently, a
> backup taken with NO_TRUNCATE might have incomplete metadata. This option
> allows backing up the log in situations where the database is damaged.
> NORECOVERY
> Backs up the tail of the log and leaves the database in the RESTORING state.
> NORECOVERY is useful when failing over to a secondary database or when
> saving the tail of the log before a RESTORE operation.
> For more info about BACKUP command go to the following link:
> http://msdn2.microsoft.com/en-us/library/ms186865.aspx
> --
> Ekrem Ã?nsoy
>
> "Balaji" <Balaji@.discussions.microsoft.com> wrote in message
> news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
> > Hi
> >
> > Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
> > with options for BACKUP LOG statement.
> >
> >
>|||There are three ways of Recovery State:
1-RECOVERY
2-NORECOVERY
3-STANDBY
If you restore your database in recovery, then your database will be online
and your users will be able to perform any operation against it.
If you restore your database in NORECOVERY then your users will not be able
to query your database.
If you restore your database in STANDBY then your users will be able to use
only SELECT against it.
Every recovery state has a purpose. You should read about this from BOL for
more information.
For example NORECOVERY and STANDBY states are being used in Log Shipping. If
you use NORECOVERY for your Log Shipping solution then your users will not
be able to query against the database on your secondary server. If you
restore your secondary database then your users will be able to query (only
SELECT) against it however your users will be disconnected each time for the
new transactions to be applied to the secondary database.
Example for no_truncate:
BACKUP LOG AdventureWorks TO DISK = N'C:\test\tiesto.bak' WITH NO_TRUNCATE
This hint is used for inaccessible database. Tibor has an article about
this, you can read it for more info:
http://www.karaszi.com/SQLServer/info_restore_no_truncate.asp
--
Ekrem Ã?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:AFC8BD66-6474-4837-A80A-B9D3FF0068E3@.microsoft.com...
> Hi Ekrem,
> Can you please explain the difference with an example.
> "Ekrem Ã?nsoy" wrote:
>> NO_TRUNCATE
>> Specifies that the log not be truncated and causes the Database Engine to
>> attempt the backup regardless of the state of the database. Consequently,
>> a
>> backup taken with NO_TRUNCATE might have incomplete metadata. This option
>> allows backing up the log in situations where the database is damaged.
>> NORECOVERY
>> Backs up the tail of the log and leaves the database in the RESTORING
>> state.
>> NORECOVERY is useful when failing over to a secondary database or when
>> saving the tail of the log before a RESTORE operation.
>> For more info about BACKUP command go to the following link:
>> http://msdn2.microsoft.com/en-us/library/ms186865.aspx
>> --
>> Ekrem Ã?nsoy
>>
>> "Balaji" <Balaji@.discussions.microsoft.com> wrote in message
>> news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
>> > Hi
>> >
>> > Can some body explain me the difference between NORECOVERY and
>> > NO_TRUNCATE
>> > with options for BACKUP LOG statement.
>> >
>> >sql

Difference between NORECOVERY and NO_TRUNCATE

Hi
Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
with options for BACKUP LOG statement.
NO_TRUNCATE
Specifies that the log not be truncated and causes the Database Engine to
attempt the backup regardless of the state of the database. Consequently, a
backup taken with NO_TRUNCATE might have incomplete metadata. This option
allows backing up the log in situations where the database is damaged.
NORECOVERY
Backs up the tail of the log and leaves the database in the RESTORING state.
NORECOVERY is useful when failing over to a secondary database or when
saving the tail of the log before a RESTORE operation.
For more info about BACKUP command go to the following link:
http://msdn2.microsoft.com/en-us/library/ms186865.aspx
Ekrem ?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
> Hi
> Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
> with options for BACKUP LOG statement.
>
|||Hi Ekrem,
Can you please explain the difference with an example.
"Ekrem ?nsoy" wrote:

> NO_TRUNCATE
> Specifies that the log not be truncated and causes the Database Engine to
> attempt the backup regardless of the state of the database. Consequently, a
> backup taken with NO_TRUNCATE might have incomplete metadata. This option
> allows backing up the log in situations where the database is damaged.
> NORECOVERY
> Backs up the tail of the log and leaves the database in the RESTORING state.
> NORECOVERY is useful when failing over to a secondary database or when
> saving the tail of the log before a RESTORE operation.
> For more info about BACKUP command go to the following link:
> http://msdn2.microsoft.com/en-us/library/ms186865.aspx
> --
> Ekrem ?nsoy
>
> "Balaji" <Balaji@.discussions.microsoft.com> wrote in message
> news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
>
|||There are three ways of Recovery State:
1-RECOVERY
2-NORECOVERY
3-STANDBY
If you restore your database in recovery, then your database will be online
and your users will be able to perform any operation against it.
If you restore your database in NORECOVERY then your users will not be able
to query your database.
If you restore your database in STANDBY then your users will be able to use
only SELECT against it.
Every recovery state has a purpose. You should read about this from BOL for
more information.
For example NORECOVERY and STANDBY states are being used in Log Shipping. If
you use NORECOVERY for your Log Shipping solution then your users will not
be able to query against the database on your secondary server. If you
restore your secondary database then your users will be able to query (only
SELECT) against it however your users will be disconnected each time for the
new transactions to be applied to the secondary database.
Example for no_truncate:
BACKUP LOG AdventureWorks TO DISK = N'C:\test\tiesto.bak' WITH NO_TRUNCATE
This hint is used for inaccessible database. Tibor has an article about
this, you can read it for more info:
http://www.karaszi.com/SQLServer/info_restore_no_truncate.asp
Ekrem ?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:AFC8BD66-6474-4837-A80A-B9D3FF0068E3@.microsoft.com...[vbcol=seagreen]
> Hi Ekrem,
> Can you please explain the difference with an example.
> "Ekrem ?nsoy" wrote:

difference between inner join and intersection

Hi Can anybody explain me what is the difference between inner join and intersection?

I prepare a query but it shows the same results then why we need two functions like this to perform same operation

Thanx-Nagu

Union

Include all rows from two similarly defined tables into one table (append operation)

Antiques1 U Antiques2

Intersection

List rows where the exact same row appears in two simlarly defined tables (actual symbol is upside-down "U")

Antiques1 intersection Antiques2

nagu

check out

http://www.dbbm.fiocruz.br/class/Lecture/d17/sql/jhoffman/sqltut.html

|||

hi,

we are here dealing in both cases with semi joins, where the rows from one (or both sides of the join operation, depending on the left/right/inner join proprosition) table are returned base on the evidence of existing related rows in the correlated table.. semi joins can be performed both via standard INNER JOIN, and via EXISTS clauses..

the inner join proposition requires for this the distinct clause as well like

SELECT DISTINCT s.Id, s.Name

FROM dbo.Students s

[INNER] JOIN dbo.Courses c ON c.StudentId = s.Id -- INNER is the default join condition

WHERE Level = @.someLevel;

which can be even expressed in

SELECT s.Id, s.Name

FROM dbo.Students s

WHERE Level = @.someLevel

AND EXISTS(

SELECT *

FROM dbo.Courses c

WHERE c.StudentId = s.Id

);

but, in this case, objviously, NULL are treated as different form each others, while set operations are supposed to consider them as equal, and, of course, you get the the result of only one of the involved object and apply DISTINCT to force non repeatable rereferences to the very same row to be returned ..

in join conditions, the correlated objects (tables/views) do not need to have the same number of columns in the results as only the evidence of existance is needed and actually no other reference to the related object is returned as output..

in INTERSECT the 2 input objects must have the same number of columns returned and base data type.. more, set operations are performed against complete rows from the 2 input objects, and here NULLs are considered to be equals..

INTERSECT returns rows present in both objects so that,

SELECT s.Id, s.Name, s.Birthday

FROM dbo.Students s

INTERCEPT

SELECT t.Id, t.Name, t.Birthday

FROM dbo.Teachers t;

returns all students that are teachers too (or the contrary if you like it better ), and this solution implyes the DISTINCT definition as well as distinct is the default (and only) implementation for INTERSECT and EXCEPT set operations in SQL Server 2005..

regards

|||

Oh thank you

Nagu

Sunday, March 25, 2012

difference between count(1) and count(*)

Hi,
Can you explain me the advantages of using one of these
statements?
I usually use the count(*) but i would like to know why
should we use one instead of the other.
Thanks a lot,
Best regardsIt's a purely syntactic difference. Use whatever one you like.
COUNT(*) is probably somewhat easier to read... but you could even use
COUNT(2349082349082398) if you felt like it.
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:27d5a01c46356$61150000$a301280a@.phx.gbl...
> Hi,
> Can you explain me the advantages of using one of these
> statements?
> I usually use the count(*) but i would like to know why
> should we use one instead of the other.
> Thanks a lot,
> Best regards|||The only instance where you could get different results would be where you
specify an actual column name instead of *. Using count(*) will return the
count of the number of rows, whilst count(<ColumnName>) will return the
number of rows where <ColumnName> is not null.
R
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:exvVSq1YEHA.2868@.TK2MSFTNGP09.phx.gbl...
> It's a purely syntactic difference. Use whatever one you like.
> COUNT(*) is probably somewhat easier to read... but you could even use
> COUNT(2349082349082398) if you felt like it.
> "CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
> news:27d5a01c46356$61150000$a301280a@.phx.gbl...
> > Hi,
> >
> > Can you explain me the advantages of using one of these
> > statements?
> > I usually use the count(*) but i would like to know why
> > should we use one instead of the other.
> >
> > Thanks a lot,
> > Best regards
>

difference between count(1) and count(*)

Hi,
Can you explain me the advantages of using one of these
statements?
I usually use the count(*) but i would like to know why
should we use one instead of the other.
Thanks a lot,
Best regardsIt's a purely syntactic difference. Use whatever one you like.
COUNT(*) is probably somewhat easier to read... but you could even use
COUNT(2349082349082398) if you felt like it.
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:27d5a01c46356$61150000$a301280a@.phx
.gbl...
> Hi,
> Can you explain me the advantages of using one of these
> statements?
> I usually use the count(*) but i would like to know why
> should we use one instead of the other.
> Thanks a lot,
> Best regards|||The only instance where you could get different results would be where you
specify an actual column name instead of *. Using count(*) will return the
count of the number of rows, whilst count(<ColumnName> ) will return the
number of rows where <ColumnName> is not null.
R
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:exvVSq1YEHA.2868@.TK2MSFTNGP09.phx.gbl...
> It's a purely syntactic difference. Use whatever one you like.
> COUNT(*) is probably somewhat easier to read... but you could even use
> COUNT(2349082349082398) if you felt like it.
> "CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
> news:27d5a01c46356$61150000$a301280a@.phx
.gbl...
>

difference between count(1) and count(*)

Hi,
Can you explain me the advantages of using one of these
statements?
I usually use the count(*) but i would like to know why
should we use one instead of the other.
Thanks a lot,
Best regards
It's a purely syntactic difference. Use whatever one you like.
COUNT(*) is probably somewhat easier to read... but you could even use
COUNT(2349082349082398) if you felt like it.
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:27d5a01c46356$61150000$a301280a@.phx.gbl...
> Hi,
> Can you explain me the advantages of using one of these
> statements?
> I usually use the count(*) but i would like to know why
> should we use one instead of the other.
> Thanks a lot,
> Best regards
|||The only instance where you could get different results would be where you
specify an actual column name instead of *. Using count(*) will return the
count of the number of rows, whilst count(<ColumnName>) will return the
number of rows where <ColumnName> is not null.
R
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:exvVSq1YEHA.2868@.TK2MSFTNGP09.phx.gbl...
> It's a purely syntactic difference. Use whatever one you like.
> COUNT(*) is probably somewhat easier to read... but you could even use
> COUNT(2349082349082398) if you felt like it.
> "CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
> news:27d5a01c46356$61150000$a301280a@.phx.gbl...
>
sql

Difference Between Comma Operator and Crossjoin?

I have two queries that appear to return the same result. Can someone explain how combining two dimensions with the comma operator differs from combining the same two dimensions using the crossjoin operator?

For example, two dimensions, account and sales. When I run this query with the cross join operator

select { [Measures].[Sales Count] } on columns,

{ ([Account].[Name].Allmembers *

[Date].[Month Val].[5] : [Date].[Month Val].Devil

) } on rows

from warehouse

it returns the same results as this query when using the comma operator to create the set:

select { [Measures].[Sales Count] } on columns,

{ ([Account].[Name].Allmembers ,

[Date].[Month Val].[5] : [Date].[Month Val].Devil

) } on rows

As crossjoin states, in example 1 above, every account is combined with every month value. When using the comma operator, I see the exact same results. Are these functionally equivalent? Any reason to use one method over the other?

Thanks....

AS2005 can be very forgiving - perhaps too forgiving - with MDX syntax...

First of all, despite appearances, there is no comma operator: the comma is used as a delimiter within a set and a tuple definition. Crossjoin you're ok with. What you're doing in your queries is producing a set of tuples containing every month crossjoined with every account and for the sake of clarity this is best written as an explicit crossjoin, either using the asterisk operator or the crossjoin function, something like this:

select { [Measures].[Sales Count] } on columns,
[Account].[Name].Allmembers * {[Date].[Month Val].[5] : [Date].[Month Val].Devil}
on rows
from warehouse

In your first query you're putting the above crossjoin operation inside a set of parentheses (), which denote a tuple - and which AS is ignoring because you're producing a set of tuples anyway. In the second query because you've put a set definition rather than a member as the second item in your tuple definition AS must be assuming that you want to do a crossjoin and is again returning the set of tuples you're after, but this behaviour is new to me and from a maintenance point of view should probably be avoided.

Chris

|||

Hi Chris,

I'm wondering whether the comma syntax in the 2nd example (which I also recall being mentioned in Teo Lachev's As 2005 book) is technically a subcube expression, as defined for the SCOPE script statement or a Cell Calculation:

http://msdn2.microsoft.com/en-us/library/ms145989.aspx

>>

Subcube_Expression ::= (Auxiliary_Subcube [, Auxiliary_Subcube,...n])

Auxiliary_Subcube ::=
Limited_Set
| Root([dimension_name])
| Leaves([dimension_name])

>>

Mosha had mentioned in his blog that a subcube could get converted to a set, under certain circumstances (though unsupported):

http://sqljunkies.com/WebLog/mosha/archive/2006/04/29/leaves.aspx

>>

How to work with Dimension Leaves

While Analysis Services may convert subcube returned by Leaves function to set (by choosing attribute hierarchies corresponding to the attributes), it is not supported usage.

>>

|||

Hmmm, possibly... In which case, if Mosha says it's unsupported, it's definitely to be avoided.

Chris

|||Agreed...crossjoin works fine. Thanks for the feedback.

difference between cast and convert in SQL

Can anyone explain in simple terms the difference between cast and convert in SQL?

They pretty much do the same thing. If you're just changing data from one form to another for use, such as changing a "45" from a varchar to an int, use CAST; Convert offers more options than cast which may lead to more processing time. And by this, I of course mean MINIMAL, not noticeable processing time. Convert allows you to add a format style to your convertion, if you want it to. For example, if you're changing a date to a string, you can say which part of the date to return instead of returning the whole thing and making .NET format it.

Here's thehelp page.

|||

Hi,

From your question, I just suggest you refer the following material

http://msdn2.microsoft.com/en-us/library/ms187928.aspx

Hope it helps.

Wednesday, March 21, 2012

Diff between Logshipping , Transaction Log backup & Transaction Replication

Can any one explain in detail difference betwen Logshipping , Transaction Log backup & Transaction Replication and which is
better over other on what circumstances?By all means you can get more explanation with code examples from books online for these topics.sql

Wednesday, March 7, 2012

Developpe axis on a graph as on a grid

Hi !
I have A question about the developpe of the axis on the graph.
I explain, when you use a matrix, you can developpe your group with a clic on (+) or (-)
, does it possible on a graph ?
For example, if I display on my axis few years, and if I want to developpe specially one, does it possible, the user clik on a (+) and my axis displays every month in my year...

I have another question, does it possible to have tooltip on a graph ?

Thank you for your answer...

Sorry this is currently not supported.

This kind of interactivity is considered for a future release.

-- Robert