Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Tuesday, March 20, 2012

collate SQL_Latin1_General_CP850_BIN to SQL_Latin1_General_CP1_CI_AS

Hi, I have a SQL Server for a SAP database with the collation
SQL_Latin1_General_CP850_BIN. When I connect to that server (or, in
this example, to another server with the SQL_Latin1_General_CP850_BIN
collation) and execute a select, the accents seem weird:

select t.TEXT
from [GC-SAP02].P01.p01.AGR_TEXTS t
where t.MANDT = '300'
and t.SPRAS = 'E'
and t.AGR_NAME = 'ZCD_GEST_DEUDA_PATENTE_SD'

TEXT
-----------
Gestin de deudas patentes en SD UP

(1 row(s) affected)

But if I connect to a "normal" SQL Server with a
SQL_Latin1_General_CP1_CI_AS collation, and execute the same select
thru a linked server:

TEXT
-----------
Gestin de deudas patentes en SD UP

(1 row(s) affected)

I need to perform the select connected to the
SQL_Latin1_General_CP850_BIN and get the results as I were connected to
the SQL_Latin1_General_CP1_CI_AS server. I tried with cast and collate,
but I can't get it to work:

select t.TEXT collate SQL_Latin1_General_CP1_CI_AS
from [GC-SAP02].P01.p01.AGR_TEXTS t
where t.MANDT = '300'
and t.SPRAS = 'E'
and t.AGR_NAME = 'ZCD_GEST_DEUDA_PATENTE_SD'

Any ideas? Thanks in advance for your help !!!

Manuel DaponteMADS (mdaponte@.gmail.com) writes:
> Hi, I have a SQL Server for a SAP database with the collation
> SQL_Latin1_General_CP850_BIN. When I connect to that server (or, in
> this example, to another server with the SQL_Latin1_General_CP850_BIN
> collation) and execute a select, the accents seem weird:
> select t.TEXT
> from [GC-SAP02].P01.p01.AGR_TEXTS t
> where t.MANDT = '300'
> and t.SPRAS = 'E'
> and t.AGR_NAME = 'ZCD_GEST_DEUDA_PATENTE_SD'
> TEXT
> -----------
> Gestin de deudas patentes en SD UP
> (1 row(s) affected)
> But if I connect to a "normal" SQL Server with a
> SQL_Latin1_General_CP1_CI_AS collation, and execute the same select
> thru a linked server:
> TEXT
> -----------
> Gestin de deudas patentes en SD UP

It looks as if the problem is that the data in the CP850 database is
wrong. Or that the collation is wrong.

in Latin-1 is 0xF4. In CP850 is at 0xA2. And guess what character
that is at 0xF4 in CP850? Yup, .

So what's happening when you select the data is that it get's converted
to Latin-1. Problem is that is already Latin-1, but labeled incorrectly.

Back in 6.5 days it was pretty easy to turn conversion on and off, but
I think it's more difficult these days. The best bet may be to run
your queries from the command-line tool OSQL. Since OSQL is an command-
line tool, it's character set is CP850, so you will not get any
conversion in this case. The output looks poor in the command-line
window, but if you save to file, the file will look good in an Windows app.

Of course, it would be a good idea to fix that database. But this may
require some care. I would not be surprised if there is a mix of
CP850 and Latin1 data in that database.

In the long run, try to get rid of the CP850 databases.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Sunday, March 11, 2012

Code.SafeDivide Expression

What does =Code.SafeDivide mean in an expression? I have an example below:
=Code.SafeDivide (Sum(Fields!revenue.Value), Sum(Fields!volume.Value))
Thanks, DeborahThe only time I've seen something like that is when you write a custom
code function called "SafeDivide". This will do a check on the divisor
(the second parameter) and, if it is 0, it will not perform the
division. It will just return 0. Here is an example I found (this
example will actually take a 3rd parameter - the "value if undefined"
parameter):
The following was snipped from this thread. Read it to see the full
explanation:
http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/browse_frm/thread/b66002620ec40e52/ed9544519ff38234?q=safedivide&rnum=2#ed9544519ff38234
Public Function SafeDivide(pi_dblNumerator As Double, pi_dblDenominator
As
Double, pi_dblUndefined As Double)
If pi_dblDenominator = 0 Then
SafeDivide = pi_dblUndefined
Else
SafeDivide = pi_dblNumerator / pi_dblDenominator
End If
End Function
Regards,
Dan

Code Section and Report Obejcts

hi,
i would have to access to report obect from Code Section Report, but i
didin't find a solution so far.
For example:
'In Code Section Report
Public MyFunction() as Integer
...
'MyParam is a defined parameter in the report
MyParma.Value=....
...
'Texbox1 is a defined textbox object in the report
'Texbox1.Value=....
...
Return ....
End Function
someone have any solution?On Jan 20, 1:14 am, "giampi" <mm...@.libero.it> wrote:
> hi,
> i would have to access to report obect from Code Section Report, but i
> didin't find a solution so far.
> For example:
> 'In Code Section Report
> Public MyFunction() as Integer
> ...
> 'MyParam is a defined parameter in the report
> MyParma.Value=....
> ...
> 'Texbox1 is a defined textbox object in the report
> 'Texbox1.Value=....
> ...
> Return ....
> End Function
> someone have any solution?
These links might be helpful.
http://www.msdner.net/dev-archive/57/19-82-574469.shtm
http://msdn.microsoft.com/msdnmag/issues/06/07/DataPoints/
Regards,
Enrique Martinez
Sr. Software Consultant

Code Samples

I am hoping that someone can direct me to a VB.Net code sample (preferably
ASP.Net) which is a good example of programatically setting ADO.Net
connection properties, calling a stored procedure, supplying user defined
parameters for the stored procedure and outputing the report to a PDF format.
I really need a sample that does all this programatically.
Any examples appreciated.
David Johnsonif you look through msdn, i'm sure you'll find enough examples.
almost for every method / function they have a code snippet
"David" wrote:
> I am hoping that someone can direct me to a VB.Net code sample (preferably
> ASP.Net) which is a good example of programatically setting ADO.Net
> connection properties, calling a stored procedure, supplying user defined
> parameters for the stored procedure and outputing the report to a PDF format.
> I really need a sample that does all this programatically.
> Any examples appreciated.
> David Johnson

Wednesday, March 7, 2012

Code Coverage Tool

I want to analyze what statemetns were executed in stored procedures,
for example.
I'm trying hard to find tools for sql code coverage while there are
tons of such tools for Java or C#.
I was able to find only : http://www.sqlpower.com/dsa.html but I want
to compare it with other solutions.Andrei
Have you tried using SQL Server Profiler?
<andrei_tapt@.mail.ru> wrote in message
news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
>I want to analyze what statemetns were executed in stored procedures,
> for example.
> I'm trying hard to find tools for sql code coverage while there are
> tons of such tools for Java or C#.
> I was able to find only : http://www.sqlpower.com/dsa.html but I want
> to compare it with other solutions.
>|||Yes, I use it as performance analyzer. I know that I can save trace in
database but it doesn't provide me any info about what sql statements
were executed ... or I don't know how to get it.
Uri Dimant =D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):
> Andrei
> Have you tried using SQL Server Profiler?
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
> >I want to analyze what statemetns were executed in stored procedures,
> > for example.
> > I'm trying hard to find tools for sql code coverage while there are
> > tons of such tools for Java or C#.
> > I was able to find only : http://www.sqlpower.com/dsa.html but I want
> > to compare it with other solutions.
> >|||<andrei_tapt@.mail.ru> wrote in message
news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
?me any info about what sql statements
>were executed ... or I don't know how to get it.
Why> There are some events to provide it. Under TSQL events select
SQL:StmtCompleted
And see in the TEXT column the resuts
http://www.sql-server-performance.com/sql_server_profiler_tips.asp
<andrei_tapt@.mail.ru> wrote in message
news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
Yes, I use it as performance analyzer. I know that I can save trace in
database but it doesn't provide me any info about what sql statements
were executed ... or I don't know how to get it.
Uri Dimant '?(?):
> Andrei
> Have you tried using SQL Server Profiler?
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
> >I want to analyze what statemetns were executed in stored procedures,
> > for example.
> > I'm trying hard to find tools for sql code coverage while there are
> > tons of such tools for Java or C#.
> > I was able to find only : http://www.sqlpower.com/dsa.html but I want
> > to compare it with other solutions.
> >|||AFAIK, I will see full text of stored procedure in TEXT column, like
using sp_helptext with stored procedure name, but I want to know which
statements were executed in this stored procedure.
Uri Dimant =D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> ?me any info about what sql statements
> >were executed ... or I don't know how to get it.
> Why> There are some events to provide it. Under TSQL events select
> SQL:StmtCompleted
> And see in the TEXT column the resuts
> http://www.sql-server-performance.com/sql_server_profiler_tips.asp
>
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> Yes, I use it as performance analyzer. I know that I can save trace in
> database but it doesn't provide me any info about what sql statements
> were executed ... or I don't know how to get it.
> Uri Dimant '?(?):
> > Andrei
> > Have you tried using SQL Server Profiler?
> >
> >
> > <andrei_tapt@.mail.ru> wrote in message
> > news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
> > >I want to analyze what statemetns were executed in stored procedures,
> > > for example.
> > > I'm trying hard to find tools for sql code coverage while there are
> > > tons of such tools for Java or C#.
> > > I was able to find only : http://www.sqlpower.com/dsa.html but I want
> > > to compare it with other solutions.
> > >|||Andrei, ty chital chto ya tebe napisal? Link etot chital?
<andrei_tapt@.mail.ru> wrote in message
news:1155119817.600289.225800@.i42g2000cwa.googlegroups.com...
AFAIK, I will see full text of stored procedure in TEXT column, like
using sp_helptext with stored procedure name, but I want to know which
statements were executed in this stored procedure.
Uri Dimant '?(?):
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> ?me any info about what sql statements
> >were executed ... or I don't know how to get it.
> Why> There are some events to provide it. Under TSQL events select
> SQL:StmtCompleted
> And see in the TEXT column the resuts
> http://www.sql-server-performance.com/sql_server_profiler_tips.asp
>
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> Yes, I use it as performance analyzer. I know that I can save trace in
> database but it doesn't provide me any info about what sql statements
> were executed ... or I don't know how to get it.
> Uri Dimant '?(?):
> > Andrei
> > Have you tried using SQL Server Profiler?
> >
> >
> > <andrei_tapt@.mail.ru> wrote in message
> > news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
> > >I want to analyze what statemetns were executed in stored procedures,
> > > for example.
> > > I'm trying hard to find tools for sql code coverage while there are
> > > tons of such tools for Java or C#.
> > > I was able to find only : http://www.sqlpower.com/dsa.html but I want
> > > to compare it with other solutions.
> > >|||Spasibo, kak raz to chto nado:) Povozitsya pridetsya, no lucshe chem
nichego. Ran'she etu stat'u videl, no bystro probezhalsya b vnimania ne
obratil. Spasibo
Uri Dimant =D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):
> Andrei, ty chital chto ya tebe napisal? Link etot chital?
> <andrei_tapt@.mail.ru> wrote in message
> news:1155119817.600289.225800@.i42g2000cwa.googlegroups.com...
> AFAIK, I will see full text of stored procedure in TEXT column, like
> using sp_helptext with stored procedure name, but I want to know which
> statements were executed in this stored procedure.
> Uri Dimant '?(?):
> > <andrei_tapt@.mail.ru> wrote in message
> > news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> > ?me any info about what sql statements
> > >were executed ... or I don't know how to get it.
> >
> > Why> There are some events to provide it. Under TSQL events select
> > SQL:StmtCompleted
> > And see in the TEXT column the resuts
> >
> > http://www.sql-server-performance.com/sql_server_profiler_tips.asp
> >
> >
> >
> >
> >
> > <andrei_tapt@.mail.ru> wrote in message
> > news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> > Yes, I use it as performance analyzer. I know that I can save trace in
> > database but it doesn't provide me any info about what sql statements
> > were executed ... or I don't know how to get it.
> >
> > Uri Dimant '?(?):
> >
> > > Andrei
> > > Have you tried using SQL Server Profiler?
> > >
> > >
> > > <andrei_tapt@.mail.ru> wrote in message
> > > news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
> > > >I want to analyze what statemetns were executed in stored procedures,
> > > > for example.
> > > > I'm trying hard to find tools for sql code coverage while there are
> > > > tons of such tools for Java or C#.
> > > > I was able to find only : http://www.sqlpower.com/dsa.html but I wa=nt
> > > > to compare it with other solutions.
> > > >|||Ok, ydachi, obrashaysya esli est' problemy
<andrei_tapt@.mail.ru> wrote in message
news:1155122187.034692.167400@.n13g2000cwa.googlegroups.com...
Spasibo, kak raz to chto nado:) Povozitsya pridetsya, no lucshe chem
nichego. Ran'she etu stat'u videl, no bystro probezhalsya b vnimania ne
obratil. Spasibo
Uri Dimant '?(?):
> Andrei, ty chital chto ya tebe napisal? Link etot chital?
> <andrei_tapt@.mail.ru> wrote in message
> news:1155119817.600289.225800@.i42g2000cwa.googlegroups.com...
> AFAIK, I will see full text of stored procedure in TEXT column, like
> using sp_helptext with stored procedure name, but I want to know which
> statements were executed in this stored procedure.
> Uri Dimant '?(?):
> > <andrei_tapt@.mail.ru> wrote in message
> > news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> > ?me any info about what sql statements
> > >were executed ... or I don't know how to get it.
> >
> > Why> There are some events to provide it. Under TSQL events select
> > SQL:StmtCompleted
> > And see in the TEXT column the resuts
> >
> > http://www.sql-server-performance.com/sql_server_profiler_tips.asp
> >
> >
> >
> >
> >
> > <andrei_tapt@.mail.ru> wrote in message
> > news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> > Yes, I use it as performance analyzer. I know that I can save trace in
> > database but it doesn't provide me any info about what sql statements
> > were executed ... or I don't know how to get it.
> >
> > Uri Dimant '?(?):
> >
> > > Andrei
> > > Have you tried using SQL Server Profiler?
> > >
> > >
> > > <andrei_tapt@.mail.ru> wrote in message
> > > news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
> > > >I want to analyze what statemetns were executed in stored procedures,
> > > > for example.
> > > > I'm trying hard to find tools for sql code coverage while there are
> > > > tons of such tools for Java or C#.
> > > > I was able to find only : http://www.sqlpower.com/dsa.html but I
> > > > want
> > > > to compare it with other solutions.
> > > >|||I did not know there were ANY code coverage tools for SQL Server. Now
I know there is at least one - thanks!
Roy
On 9 Aug 2006 00:43:24 -0700, andrei_tapt@.mail.ru wrote:
>I want to analyze what statemetns were executed in stored procedures,
>for example.
>I'm trying hard to find tools for sql code coverage while there are
>tons of such tools for Java or C#.
>I was able to find only : http://www.sqlpower.com/dsa.html but I want
>to compare it with other solutions.

Code Coverage Tool

I want to analyze what statemetns were executed in stored procedures,
for example.
I'm trying hard to find tools for sql code coverage while there are
tons of such tools for Java or C#.
I was able to find only : http://www.sqlpower.com/dsa.html but I want
to compare it with other solutions.Andrei
Have you tried using SQL Server Profiler?
<andrei_tapt@.mail.ru> wrote in message
news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...
>I want to analyze what statemetns were executed in stored procedures,
> for example.
> I'm trying hard to find tools for sql code coverage while there are
> tons of such tools for Java or C#.
> I was able to find only : http://www.sqlpower.com/dsa.html but I want
> to compare it with other solutions.
>|||Yes, I use it as performance analyzer. I know that I can save trace in
database but it doesn't provide me any info about what sql statements
were executed ... or I don't know how to get it.
Uri Dimant =D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):
[vbcol=seagreen]
> Andrei
> Have you tried using SQL Server Profiler?
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...|||<andrei_tapt@.mail.ru> wrote in message
news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
?me any info about what sql statements
>were executed ... or I don't know how to get it.
Why> There are some events to provide it. Under TSQL events select
SQL:StmtCompleted
And see in the TEXT column the resuts
http://www.sql-server-performance.c...ofiler_tips.asp
<andrei_tapt@.mail.ru> wrote in message
news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
Yes, I use it as performance analyzer. I know that I can save trace in
database but it doesn't provide me any info about what sql statements
were executed ... or I don't know how to get it.
Uri Dimant '?(?):
[vbcol=seagreen]
> Andrei
> Have you tried using SQL Server Profiler?
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155109404.400115.317600@.h48g2000cwc.googlegroups.com...|||AFAIK, I will see full text of stored procedure in TEXT column, like
using sp_helptext with stored procedure name, but I want to know which
statements were executed in this stored procedure.
Uri Dimant =D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):
[vbcol=seagreen]
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> ?me any info about what sql statements
> Why> There are some events to provide it. Under TSQL events select
> SQL:StmtCompleted
> And see in the TEXT column the resuts
> http://www.sql-server-performance.c...ofiler_tips.asp
>
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> Yes, I use it as performance analyzer. I know that I can save trace in
> database but it doesn't provide me any info about what sql statements
> were executed ... or I don't know how to get it.
> Uri Dimant '?(?):
>|||Andrei, ty chital chto ya tebe napisal? Link etot chital?
<andrei_tapt@.mail.ru> wrote in message
news:1155119817.600289.225800@.i42g2000cwa.googlegroups.com...
AFAIK, I will see full text of stored procedure in TEXT column, like
using sp_helptext with stored procedure name, but I want to know which
statements were executed in this stored procedure.
Uri Dimant '?(?):
[vbcol=seagreen]
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> ?me any info about what sql statements
> Why> There are some events to provide it. Under TSQL events select
> SQL:StmtCompleted
> And see in the TEXT column the resuts
> http://www.sql-server-performance.c...ofiler_tips.asp
>
>
> <andrei_tapt@.mail.ru> wrote in message
> news:1155116699.048307.322460@.i3g2000cwc.googlegroups.com...
> Yes, I use it as performance analyzer. I know that I can save trace in
> database but it doesn't provide me any info about what sql statements
> were executed ... or I don't know how to get it.
> Uri Dimant '?(?):
>|||Spasibo, kak raz to chto nado Povozitsya pridetsya, no lucshe chem
nichego. Ran'she etu stat'u videl, no bystro probezhalsya b vnimania ne
obratil. Spasibo
Uri Dimant =D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):
[vbcol=seagreen]
> Andrei, ty chital chto ya tebe napisal? Link etot chital?
> <andrei_tapt@.mail.ru> wrote in message
> news:1155119817.600289.225800@.i42g2000cwa.googlegroups.com...
> AFAIK, I will see full text of stored procedure in TEXT column, like
> using sp_helptext with stored procedure name, but I want to know which
> statements were executed in this stored procedure.
> Uri Dimant '?(?):
>
nt[vbcol=seagreen]|||Ok, ydachi, obrashaysya esli est' problemy
<andrei_tapt@.mail.ru> wrote in message
news:1155122187.034692.167400@.n13g2000cwa.googlegroups.com...
Spasibo, kak raz to chto nado Povozitsya pridetsya, no lucshe chem
nichego. Ran'she etu stat'u videl, no bystro probezhalsya b vnimania ne
obratil. Spasibo
Uri Dimant '?(?):
[vbcol=seagreen]
> Andrei, ty chital chto ya tebe napisal? Link etot chital?
> <andrei_tapt@.mail.ru> wrote in message
> news:1155119817.600289.225800@.i42g2000cwa.googlegroups.com...
> AFAIK, I will see full text of stored procedure in TEXT column, like
> using sp_helptext with stored procedure name, but I want to know which
> statements were executed in this stored procedure.
> Uri Dimant '?(?):
>|||I did not know there were ANY code coverage tools for SQL Server. Now
I know there is at least one - thanks!
Roy
On 9 Aug 2006 00:43:24 -0700, andrei_tapt@.mail.ru wrote:

>I want to analyze what statemetns were executed in stored procedures,
>for example.
>I'm trying hard to find tools for sql code coverage while there are
>tons of such tools for Java or C#.
>I was able to find only : http://www.sqlpower.com/dsa.html but I want
>to compare it with other solutions.

Code and diff sql servers

I'm running out of ideas...
Given the following example of code:
set @.partialname = 'u'
SELECT col1, col2, col3
FROM tbl1
WHERE col1 LIKE @.partialName + '%'
ORDER BY col1
Why would two different sql servers, having exactly the same data, give
different results? One server returns an empty set, while the other returns
all rows where col1 starts with 'u'. A server setting I'm guessing, but
can't find what it is.
Can you help?crud - I messed up my explanation- it works with the 'u' but not when
@.partialname is blank ('').
Its this code that works on one server, but not the other:
set @.partialname = ''
SELECT col1, col2, col3
FROM tbl1
WHERE col1 LIKE @.partialName + '%'
ORDER BY col1
If @.partialname = 'u' -- both servers process correctly.
Sorry about that.
'
"mikeb" <mike@.nohostanywhere.com> wrote in message
news:uMmFbzANGHA.3908@.TK2MSFTNGP10.phx.gbl...
> I'm running out of ideas...
> Given the following example of code:
> set @.partialname = 'u'
> SELECT col1, col2, col3
> FROM tbl1
> WHERE col1 LIKE @.partialName + '%'
> ORDER BY col1
> Why would two different sql servers, having exactly the same data, give
> different results? One server returns an empty set, while the other
> returns all rows where col1 starts with 'u'. A server setting I'm
> guessing, but can't find what it is.
> Can you help?
>
>|||My guess is that the one thing you do not show - the data type of
partialname - is the problem. Is it, by any chance, CHAR(1)? If so
you are matching on ' %' when it is blank. Try making it varchar.
And you might have tried a little research of your own:
set @.partialname = ''
SELECT @.partialName + '%'
Roy
On Fri, 17 Feb 2006 14:03:14 -0800, "mikeb" <mike@.nohostanywhere.com>
wrote:

>crud - I messed up my explanation- it works with the 'u' but not when
>@.partialname is blank ('').
>Its this code that works on one server, but not the other:
>set @.partialname = ''
>SELECT col1, col2, col3
>FROM tbl1
>WHERE col1 LIKE @.partialName + '%'
>ORDER BY col1
>If @.partialname = 'u' -- both servers process correctly.
>Sorry about that.
>'
>"mikeb" <mike@.nohostanywhere.com> wrote in message
>news:uMmFbzANGHA.3908@.TK2MSFTNGP10.phx.gbl...
>|||TRIED RESEARCH OF MY OWN? I've done tons of searches Roy, spent the last
couple hours trying different options. ALL before posting.
You might want to get your crystal ball in for repair - it doesn't seem to
be working today...
@.partialname is VarChar(50)
It appears that the other database is SQL7, versus SQL2000 (which works)
"Roy Harvey" <roy_harvey@.snet.net> wrote in message
news:31mcv1lrouvu2dri9u7b0rbt19a91i4gcv@.
4ax.com...
> My guess is that the one thing you do not show - the data type of
> partialname - is the problem. Is it, by any chance, CHAR(1)? If so
> you are matching on ' %' when it is blank. Try making it varchar.
> And you might have tried a little research of your own:
> set @.partialname = ''
> SELECT @.partialName + '%'
> Roy
>
> On Fri, 17 Feb 2006 14:03:14 -0800, "mikeb" <mike@.nohostanywhere.com>
> wrote:
>|||It seems that the difference was that even though @.partialName, a
varchar(50), was passed an empty string ('') to the s.proc, SQL7 somehow
converted it to a single blank char (' '). Where SQL2000 left it empty. I
could very well be doing something wrong here - I'm just trying to fix an
error in what code we were left with. Open to suggestions if its bad form.
Wow. I even kept researching after my hand was slapped for not (sic)...
pomposity gets really tiring sometimes.
"mikeb" <mike@.nohostanywhere.com> wrote in message
news:udUKw1BNGHA.2752@.TK2MSFTNGP14.phx.gbl...
> TRIED RESEARCH OF MY OWN? I've done tons of searches Roy, spent the last
> couple hours trying different options. ALL before posting.
> You might want to get your crystal ball in for repair - it doesn't seem to
> be working today...
> @.partialname is VarChar(50)
> It appears that the other database is SQL7, versus SQL2000 (which works)
>
> "Roy Harvey" <roy_harvey@.snet.net> wrote in message
> news:31mcv1lrouvu2dri9u7b0rbt19a91i4gcv@.
4ax.com...
>|||Sorry it came across that way. My apologies.
You should be able to get around the problem with:
RTRIM(@.partialName) + '%'
Roy|||Yep, thats exactly what I did to get it working - I meant to mention that
too in the previous post. thx.
"Roy Harvey" <roy_harvey@.snet.net> wrote in message
news:27scv1l4fqtv3hrvuf0msr6q6elv7fl5ej@.
4ax.com...
> Sorry it came across that way. My apologies.
> You should be able to get around the problem with:
> RTRIM(@.partialName) + '%'
> Roy

Sunday, February 12, 2012

Clustered Index or NonClustered Index

Hello I want to learn disparity clustered index or nonclustered index and in queries which one run better.

example

select * from orders where orderID=5

to this query clustered or nonclustered

thanks

Big topic. Simple answer, yes, you probably want to cluster on the surrogate key, especially when using a smaller datatype surrogate like an int. The way SQL Server uses clustered indexes it is almost always the best choice.

Better answer. Read indexing topics in books online, and the start here one the web: http://www.sql-server-performance.com/optimizing_indexes.asp. Or just start there if you wanna. Books online has good information that is crucial to understanding indexes, however.

|||

Thank you very much