Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts

Thursday, March 29, 2012

Basic Question: Setting a varaiable to a datasource.select value

Hi!


I am trying to do something that I would think should be rather simple.

I have a SQLDataSource that has a simple select statement.

I have a String Variable st_temp

I know my SQLDataSource returns only one value, and it's a string.

HOW DO I DO somehitng like st_temp=SQLDataSource.Select;

I am getting nothing but errorrs

Thanks in advance

Dan

What errors are you getting?|||

If you are using just a single value then there is no need for SQLDataSource object. You can directly use SQLCommand.ExecuteScalar() method.

|||

2 things:

1. sorry to be so dense but how do I use SQLCommand.ExecuteScalar() method. in C#?

2. Errors are

":CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement" when I call SDSSelect.Select;

and

":CS0428: Cannot convert method group 'Select' to non-delegate type 'string'. Did you intend to invoke the method?" when I call Label1.Text= SDSSelect.Select;



Thanks again for the help...i shouldda stayed in Java land!|||

Thanks for all the HELP!!!

Dan

Basic question.... on Index....

Why the name clustered is used in the clustered index? What is exactly
clustered here?
Thanks,
Jessy
Hi,
Physical ordering of data inside the data page will be same as the Index key
order.
The pages in the data chain and the records on the pages are ordered on the
value of the clustered index key. All inserts are made at the point the key
value in the inserted row fits in the ordering sequence.
See more details of cluetsred index in books online.
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>
|||Clustered means the index keys and the table are clustered in the same page?
Jessy
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
> Hi,
> Physical ordering of data inside the data page will be same as the Index
key
> order.
> The pages in the data chain and the records on the pages are ordered on
the
> value of the clustered index key. All inserts are made at the point the
key
> value in the inserted row fits in the ordering sequence.
> See more details of cluetsred index in books online.
>
> Thanks
> Hari
> SQL Server MVP
>
> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
> news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
>
|||Hi,
No. There are seperate Index and Data pages. read the below article.
http://msdn.microsoft.com/library/de...es_05_5h6b.asp
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23rDFQpsZFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Clustered means the index keys and the table are clustered in the same
> page?
> Jessy
>
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
> key
> the
> key
>
|||"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:#Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>
As an example...
A clustered index is sort of like a dictionary. The keys (dictionary words)
are stored in sorted order. If you need to add a new row called Alligator,
then it would be placed in the correct location in the dictionary.
A non-clustered index is more like the index you find at the back of a book.
The index at the back of the book is stored in sorted order, however, it has
page numbers which tell you to go to page xx to find your word. When you
insert a row here, the data will be appended to the end of the table (unless
you have a clustered index on it), and the index at the back of the book
will be updated appropriately.
One thing to note is that when you have a nonclustered index on a table that
has a clustered index, the "page numbers" don't actually point at the pages,
but rather point at the clustered index key (dictionary word from above).
When you do an insert, the nonclustered index has it's row modified and it
then points to the clustered index key and the row is added in the
dictionary order.
HTH
Rick Sawtell
MCT, MCSD, MCDBA
|||Excellent explanation. This is the sort of explanation I was looking
Thank you very much,
Jessy
"Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
news:OYPXjysZFHA.1456@.TK2MSFTNGP15.phx.gbl...
> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
> news:#Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> As an example...
> A clustered index is sort of like a dictionary. The keys (dictionary
words)
> are stored in sorted order. If you need to add a new row called
Alligator,
> then it would be placed in the correct location in the dictionary.
> A non-clustered index is more like the index you find at the back of a
book.
> The index at the back of the book is stored in sorted order, however, it
has
> page numbers which tell you to go to page xx to find your word. When you
> insert a row here, the data will be appended to the end of the table
(unless
> you have a clustered index on it), and the index at the back of the book
> will be updated appropriately.
> One thing to note is that when you have a nonclustered index on a table
that
> has a clustered index, the "page numbers" don't actually point at the
pages,
> but rather point at the clustered index key (dictionary word from above).
> When you do an insert, the nonclustered index has it's row modified and it
> then points to the clustered index key and the row is added in the
> dictionary order.
> HTH
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>
|||One of the main benefits of clustered indexes is that you can get better
response for range queries or queries with duplicate keys, because the data
is stored on the same or side by side pages. An IO of 1 page will return
multiple rows that satisfy such a query, reducing IO time in a big way.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>
|||Hari:
I'm not sure what you mean by this statement. Your statement is true for
non-clustered indexes, but for the clustered index, the index key and the
data are on the same pages and ARE the data pages. The clustered index does
not use Index pages; they are the data pages, at the leaf level.
Sincerely,
Anthony Thomas

"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Tcu7vsZFHA.3120@.TK2MSFTNGP12.phx.gbl...
Hi,
No. There are seperate Index and Data pages. read the below article.
http://msdn.microsoft.com/library/de...es_05_5h6b.asp
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23rDFQpsZFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Clustered means the index keys and the table are clustered in the same
> page?
> Jessy
>
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
> key
> the
> key
>
sql

Basic question.... on Index....

Why the name clustered is used in the clustered index? What is exactly
clustered here?
Thanks,
JessyHi,
Physical ordering of data inside the data page will be same as the Index key
order.
The pages in the data chain and the records on the pages are ordered on the
value of the clustered index key. All inserts are made at the point the key
value in the inserted row fits in the ordering sequence.
See more details of cluetsred index in books online.
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>|||Clustered means the index keys and the table are clustered in the same page?
Jessy
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
> Hi,
> Physical ordering of data inside the data page will be same as the Index
key
> order.
> The pages in the data chain and the records on the pages are ordered on
the
> value of the clustered index key. All inserts are made at the point the
key
> value in the inserted row fits in the ordering sequence.
> See more details of cluetsred index in books online.
>
> Thanks
> Hari
> SQL Server MVP
>
> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
> news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> > Why the name clustered is used in the clustered index? What is exactly
> > clustered here?
> >
> > Thanks,
> >
> > Jessy
> >
> >
>|||Hi,
No. There are seperate Index and Data pages. read the below article.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_05_5h6b.asp
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23rDFQpsZFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Clustered means the index keys and the table are clustered in the same
> page?
> Jessy
>
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
>> Hi,
>> Physical ordering of data inside the data page will be same as the Index
> key
>> order.
>> The pages in the data chain and the records on the pages are ordered on
> the
>> value of the clustered index key. All inserts are made at the point the
> key
>> value in the inserted row fits in the ordering sequence.
>> See more details of cluetsred index in books online.
>>
>> Thanks
>> Hari
>> SQL Server MVP
>>
>> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
>> news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
>> > Why the name clustered is used in the clustered index? What is exactly
>> > clustered here?
>> >
>> > Thanks,
>> >
>> > Jessy
>> >
>> >
>>
>|||"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:#Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>
As an example...
A clustered index is sort of like a dictionary. The keys (dictionary words)
are stored in sorted order. If you need to add a new row called Alligator,
then it would be placed in the correct location in the dictionary.
A non-clustered index is more like the index you find at the back of a book.
The index at the back of the book is stored in sorted order, however, it has
page numbers which tell you to go to page xx to find your word. When you
insert a row here, the data will be appended to the end of the table (unless
you have a clustered index on it), and the index at the back of the book
will be updated appropriately.
One thing to note is that when you have a nonclustered index on a table that
has a clustered index, the "page numbers" don't actually point at the pages,
but rather point at the clustered index key (dictionary word from above).
When you do an insert, the nonclustered index has it's row modified and it
then points to the clustered index key and the row is added in the
dictionary order.
HTH
Rick Sawtell
MCT, MCSD, MCDBA|||Excellent explanation. This is the sort of explanation I was looking
Thank you very much,
Jessy
"Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
news:OYPXjysZFHA.1456@.TK2MSFTNGP15.phx.gbl...
> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
> news:#Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> > Why the name clustered is used in the clustered index? What is exactly
> > clustered here?
> >
> > Thanks,
> >
> > Jessy
> >
> >
> As an example...
> A clustered index is sort of like a dictionary. The keys (dictionary
words)
> are stored in sorted order. If you need to add a new row called
Alligator,
> then it would be placed in the correct location in the dictionary.
> A non-clustered index is more like the index you find at the back of a
book.
> The index at the back of the book is stored in sorted order, however, it
has
> page numbers which tell you to go to page xx to find your word. When you
> insert a row here, the data will be appended to the end of the table
(unless
> you have a clustered index on it), and the index at the back of the book
> will be updated appropriately.
> One thing to note is that when you have a nonclustered index on a table
that
> has a clustered index, the "page numbers" don't actually point at the
pages,
> but rather point at the clustered index key (dictionary word from above).
> When you do an insert, the nonclustered index has it's row modified and it
> then points to the clustered index key and the row is added in the
> dictionary order.
> HTH
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>|||One of the main benefits of clustered indexes is that you can get better
response for range queries or queries with duplicate keys, because the data
is stored on the same or side by side pages. An IO of 1 page will return
multiple rows that satisfy such a query, reducing IO time in a big way.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>|||Hari:
I'm not sure what you mean by this statement. Your statement is true for
non-clustered indexes, but for the clustered index, the index key and the
data are on the same pages and ARE the data pages. The clustered index does
not use Index pages; they are the data pages, at the leaf level.
Sincerely,
Anthony Thomas
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Tcu7vsZFHA.3120@.TK2MSFTNGP12.phx.gbl...
Hi,
No. There are seperate Index and Data pages. read the below article.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_05_5h6b.asp
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23rDFQpsZFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Clustered means the index keys and the table are clustered in the same
> page?
> Jessy
>
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
>> Hi,
>> Physical ordering of data inside the data page will be same as the Index
> key
>> order.
>> The pages in the data chain and the records on the pages are ordered on
> the
>> value of the clustered index key. All inserts are made at the point the
> key
>> value in the inserted row fits in the ordering sequence.
>> See more details of cluetsred index in books online.
>>
>> Thanks
>> Hari
>> SQL Server MVP
>>
>> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
>> news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
>> > Why the name clustered is used in the clustered index? What is exactly
>> > clustered here?
>> >
>> > Thanks,
>> >
>> > Jessy
>> >
>> >
>>
>

Basic question.... on Index....

Why the name clustered is used in the clustered index? What is exactly
clustered here?
Thanks,
JessyHi,
Physical ordering of data inside the data page will be same as the Index key
order.
The pages in the data chain and the records on the pages are ordered on the
value of the clustered index key. All inserts are made at the point the key
value in the inserted row fits in the ordering sequence.
See more details of cluetsred index in books online.
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>|||Clustered means the index keys and the table are clustered in the same page?
Jessy
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
> Hi,
> Physical ordering of data inside the data page will be same as the Index
key
> order.
> The pages in the data chain and the records on the pages are ordered on
the
> value of the clustered index key. All inserts are made at the point the
key
> value in the inserted row fits in the ordering sequence.
> See more details of cluetsred index in books online.
>
> Thanks
> Hari
> SQL Server MVP
>
> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
> news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
>|||Hi,
No. There are seperate Index and Data pages. read the below article.
_05_5h6b.asp" target="_blank">http://msdn.microsoft.com/library/d...>
_05_5h6b.asp
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23rDFQpsZFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Clustered means the index keys and the table are clustered in the same
> page?
> Jessy
>
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
> key
> the
> key
>|||"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:#Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>
As an example...
A clustered index is sort of like a dictionary. The keys (dictionary words)
are stored in sorted order. If you need to add a new row called Alligator,
then it would be placed in the correct location in the dictionary.
A non-clustered index is more like the index you find at the back of a book.
The index at the back of the book is stored in sorted order, however, it has
page numbers which tell you to go to page xx to find your word. When you
insert a row here, the data will be appended to the end of the table (unless
you have a clustered index on it), and the index at the back of the book
will be updated appropriately.
One thing to note is that when you have a nonclustered index on a table that
has a clustered index, the "page numbers" don't actually point at the pages,
but rather point at the clustered index key (dictionary word from above).
When you do an insert, the nonclustered index has it's row modified and it
then points to the clustered index key and the row is added in the
dictionary order.
HTH
Rick Sawtell
MCT, MCSD, MCDBA|||Excellent explanation. This is the sort of explanation I was looking
Thank you very much,
Jessy
"Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
news:OYPXjysZFHA.1456@.TK2MSFTNGP15.phx.gbl...
> "Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
> news:#Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> As an example...
> A clustered index is sort of like a dictionary. The keys (dictionary
words)
> are stored in sorted order. If you need to add a new row called
Alligator,
> then it would be placed in the correct location in the dictionary.
> A non-clustered index is more like the index you find at the back of a
book.
> The index at the back of the book is stored in sorted order, however, it
has
> page numbers which tell you to go to page xx to find your word. When you
> insert a row here, the data will be appended to the end of the table
(unless
> you have a clustered index on it), and the index at the back of the book
> will be updated appropriately.
> One thing to note is that when you have a nonclustered index on a table
that
> has a clustered index, the "page numbers" don't actually point at the
pages,
> but rather point at the clustered index key (dictionary word from above).
> When you do an insert, the nonclustered index has it's row modified and it
> then points to the clustered index key and the row is added in the
> dictionary order.
> HTH
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>|||One of the main benefits of clustered indexes is that you can get better
response for range queries or queries with duplicate keys, because the data
is stored on the same or side by side pages. An IO of 1 page will return
multiple rows that satisfy such a query, reducing IO time in a big way.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23Sy2IfsZFHA.3852@.TK2MSFTNGP10.phx.gbl...
> Why the name clustered is used in the clustered index? What is exactly
> clustered here?
> Thanks,
> Jessy
>|||Hari:
I'm not sure what you mean by this statement. Your statement is true for
non-clustered indexes, but for the clustered index, the index key and the
data are on the same pages and ARE the data pages. The clustered index does
not use Index pages; they are the data pages, at the leaf level.
Sincerely,
Anthony Thomas
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Tcu7vsZFHA.3120@.TK2MSFTNGP12.phx.gbl...
Hi,
No. There are seperate Index and Data pages. read the below article.
_05_5h6b.asp" target="_blank">http://msdn.microsoft.com/library/d...>
_05_5h6b.asp
Thanks
Hari
SQL Server MVP
"Jessy Martin" <Jessy_Smith79@.hotmail.com> wrote in message
news:%23rDFQpsZFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Clustered means the index keys and the table are clustered in the same
> page?
> Jessy
>
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23xMrpksZFHA.2128@.TK2MSFTNGP14.phx.gbl...
> key
> the
> key
>

Basic Question on SQL Server 2005 Backup Theory

I am replicating a large number of databases (the size changes
dynamically) from one sql server to another, all pragmatically.
Once a week, I do a full backup and restore it on the destination.
All other times I am just backing up the log files, copying them over,
and restoring them. Basically a glorified log ship.
About once a week, I get various exceptions stating the following:
********
System.Data.SqlClient.SqlException: BACKUP LOG cannot be performed
because there is no current database backup.
********
My question is: with this scenario, how often do I have to actually
perform a full backup? Does SQL Server 2005 really care?
Thanks a lot,
Michael Gorsuch
> My question is: with this scenario, how often do I have to actually
> perform a full backup? Does SQL Server 2005 really care?
Only the very first time. Assuming you ship all transaction log backups, and don't do anything with
the originating database that break the log backup sequence (like put it in simple recovery model).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael Gorsuch" <michael.gorsuch@.gmail.com> wrote in message
news:1177597505.788472.212590@.t39g2000prd.googlegr oups.com...
>I am replicating a large number of databases (the size changes
> dynamically) from one sql server to another, all pragmatically.
> Once a week, I do a full backup and restore it on the destination.
> All other times I am just backing up the log files, copying them over,
> and restoring them. Basically a glorified log ship.
> About once a week, I get various exceptions stating the following:
> ********
> System.Data.SqlClient.SqlException: BACKUP LOG cannot be performed
> because there is no current database backup.
> ********
> My question is: with this scenario, how often do I have to actually
> perform a full backup? Does SQL Server 2005 really care?
> Thanks a lot,
> Michael Gorsuch
>

Basic Question on SQL Server 2005 Backup Theory

I am replicating a large number of databases (the size changes
dynamically) from one sql server to another, all pragmatically.
Once a week, I do a full backup and restore it on the destination.
All other times I am just backing up the log files, copying them over,
and restoring them. Basically a glorified log ship.
About once a week, I get various exceptions stating the following:
********
System.Data.SqlClient.SqlException: BACKUP LOG cannot be performed
because there is no current database backup.
********
My question is: with this scenario, how often do I have to actually
perform a full backup? Does SQL Server 2005 really care?
Thanks a lot,
Michael Gorsuch> My question is: with this scenario, how often do I have to actually
> perform a full backup? Does SQL Server 2005 really care?
Only the very first time. Assuming you ship all transaction log backups, and
don't do anything with
the originating database that break the log backup sequence (like put it in
simple recovery model).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael Gorsuch" <michael.gorsuch@.gmail.com> wrote in message
news:1177597505.788472.212590@.t39g2000prd.googlegroups.com...
>I am replicating a large number of databases (the size changes
> dynamically) from one sql server to another, all pragmatically.
> Once a week, I do a full backup and restore it on the destination.
> All other times I am just backing up the log files, copying them over,
> and restoring them. Basically a glorified log ship.
> About once a week, I get various exceptions stating the following:
> ********
> System.Data.SqlClient.SqlException: BACKUP LOG cannot be performed
> because there is no current database backup.
> ********
> My question is: with this scenario, how often do I have to actually
> perform a full backup? Does SQL Server 2005 really care?
> Thanks a lot,
> Michael Gorsuch
>

Basic Question on SQL Server 2005 Backup Theory

I am replicating a large number of databases (the size changes
dynamically) from one sql server to another, all pragmatically.
Once a week, I do a full backup and restore it on the destination.
All other times I am just backing up the log files, copying them over,
and restoring them. Basically a glorified log ship.
About once a week, I get various exceptions stating the following:
********
System.Data.SqlClient.SqlException: BACKUP LOG cannot be performed
because there is no current database backup.
********
My question is: with this scenario, how often do I have to actually
perform a full backup? Does SQL Server 2005 really care?
Thanks a lot,
Michael Gorsuch> My question is: with this scenario, how often do I have to actually
> perform a full backup? Does SQL Server 2005 really care?
Only the very first time. Assuming you ship all transaction log backups, and don't do anything with
the originating database that break the log backup sequence (like put it in simple recovery model).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael Gorsuch" <michael.gorsuch@.gmail.com> wrote in message
news:1177597505.788472.212590@.t39g2000prd.googlegroups.com...
>I am replicating a large number of databases (the size changes
> dynamically) from one sql server to another, all pragmatically.
> Once a week, I do a full backup and restore it on the destination.
> All other times I am just backing up the log files, copying them over,
> and restoring them. Basically a glorified log ship.
> About once a week, I get various exceptions stating the following:
> ********
> System.Data.SqlClient.SqlException: BACKUP LOG cannot be performed
> because there is no current database backup.
> ********
> My question is: with this scenario, how often do I have to actually
> perform a full backup? Does SQL Server 2005 really care?
> Thanks a lot,
> Michael Gorsuch
>sql

Tuesday, March 27, 2012

Basic Question on SQL SELECT Performance

Hi, I hope this is an appropriate group to ask a question about basic SQL
SELECT performance.
I'm creating a VIEW which draws together two tables; T_ONE and T_MANY.
Basically, the VIEW creates a LEFT JOIN from T_ONE to T_MANY so that the Ad
Hoc SQL submitted from the software is simply a SELECT * from the VIEW. (I
like to use views to keep software-embedded SQL as simple as possible.)
Now here's the thing. The item from the WHERE clause when selecting from
this view is from a column in T_MANY. Does this indicate that for
performance reasons I should place T_MANY on the left side of the JOIN? I've
always thought that relative JOIN placement defines logical join
relationship, but that the optimizer would intelligently decide upon the
quickest path to the data, regardless of where a particular table is placed
in the JOIN.
Disclaimer: I'm using a different DBMS right now, Interbase, and was getting
absolutely horrible performance until I switched T_MANY around to the left
side of the join. We're migrating to SQL Server and I'm wondering whether
what I'm seeing is actually a feature of SQL, or whether Interbase simply
doesn't 'have the brains' to optimize the query properly. Would this be a
problem in SQL Server as well? Would an INNER JOIN be more efficient than a
LEFT join (effectively, our relationship constraints mandate that these must
be INNER joins anyway - it's not possible for an entry to exist in either
table without at least one match in the other table) or should it make no
difference?
Thanks for your advice.
Joe GeretzDefintely Inner join is better then Outer Joins.
In the Query, is that you are only filtering the rows between the two tables
with a where clause or is it that you are trying to find out all the left
items and replacing them with values.
From my understanding you are trying to do a simple join. So please use
Inner Join and it should give you a good performance and make sure indexes
are done properly on the tables where the join is made. And if it contains
too many rows then collect statistics before you do the join.
Shyam
"Joseph Geretz" <jgeretz@.nospam.com> wrote in message
news:OxNKHB4DEHA.1544@.TK2MSFTNGP09.phx.gbl...
> Hi, I hope this is an appropriate group to ask a question about basic SQL
> SELECT performance.
> I'm creating a VIEW which draws together two tables; T_ONE and T_MANY.
> Basically, the VIEW creates a LEFT JOIN from T_ONE to T_MANY so that the
Ad
> Hoc SQL submitted from the software is simply a SELECT * from the VIEW. (I
> like to use views to keep software-embedded SQL as simple as possible.)
> Now here's the thing. The item from the WHERE clause when selecting from
> this view is from a column in T_MANY. Does this indicate that for
> performance reasons I should place T_MANY on the left side of the JOIN?
I've
> always thought that relative JOIN placement defines logical join
> relationship, but that the optimizer would intelligently decide upon the
> quickest path to the data, regardless of where a particular table is
placed
> in the JOIN.
> Disclaimer: I'm using a different DBMS right now, Interbase, and was
getting
> absolutely horrible performance until I switched T_MANY around to the left
> side of the join. We're migrating to SQL Server and I'm wondering whether
> what I'm seeing is actually a feature of SQL, or whether Interbase simply
> doesn't 'have the brains' to optimize the query properly. Would this be a
> problem in SQL Server as well? Would an INNER JOIN be more efficient than
a
> LEFT join (effectively, our relationship constraints mandate that these
must
> be INNER joins anyway - it's not possible for an entry to exist in either
> table without at least one match in the other table) or should it make no
> difference?
> Thanks for your advice.
> Joe Geretz
>
>

basic question on permissions..

I have some contractors termserving into my sql2000
server. They need to admin the sql databases and use the
query analyzer. What is the best way for me to give them
permissions to do this without making them local
administrators of the box?Can you allow them to Term Serv into another machine other than SQL?
Running queries and managing the database doesn't equate to having to be a
sysadmin.
What exactly do they need to do?
Perhaps all they need is DBO access to their database, not Sysadmin access
to the entire server.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Basic Question on Join

Hi,

I'm pretty much a database beginner and have what I think is a basic
question:

If I have a table which has a 'status' column and I can have say three
statuses: "active", "pending", "inactive". Is it better to break these
out into a different "Statuses" table?

On the one hand it seems to me it would be better to be in a different
table since I'll index this column because I'll be in a where clause
sometimes and I think indexing it would be easier than indexing the
actual words. On the other hand, are joins going to slow queries down
too much? I read something about creating my own sql server 2000
datatype - would this be a good place to do such a thing?

Thanks for your help. (And if you could provide a reason why one
solution is better than the other so I can start understanding better,
I'd be very appreciative.)

Thanks.nick wrote:
> Hi,
> I'm pretty much a database beginner and have what I think is a basic
> question:
> If I have a table which has a 'status' column and I can have say three
> statuses: "active", "pending", "inactive". Is it better to break these
> out into a different "Statuses" table?
> On the one hand it seems to me it would be better to be in a different
> table since I'll index this column because I'll be in a where clause
> sometimes and I think indexing it would be easier than indexing the
> actual words. On the other hand, are joins going to slow queries down
> too much? I read something about creating my own sql server 2000
> datatype - would this be a good place to do such a thing?
> Thanks for your help. (And if you could provide a reason why one
> solution is better than the other so I can start understanding better,
> I'd be very appreciative.)
> Thanks.

If you're storing addresses should you have 50 separate tables, one for
each state?

Zach|||"nick" <nickgieschen@.hotmail.com> wrote in message
news:305cab98.0411191325.29e48efc@.posting.google.c om...
> Hi,
> I'm pretty much a database beginner and have what I think is a basic
> question:
> If I have a table which has a 'status' column and I can have say three
> statuses: "active", "pending", "inactive". Is it better to break these
> out into a different "Statuses" table?
> On the one hand it seems to me it would be better to be in a different
> table since I'll index this column because I'll be in a where clause
> sometimes and I think indexing it would be easier than indexing the
> actual words. On the other hand, are joins going to slow queries down
> too much? I read something about creating my own sql server 2000
> datatype - would this be a good place to do such a thing?
> Thanks for your help. (And if you could provide a reason why one
> solution is better than the other so I can start understanding better,
> I'd be very appreciative.)

Having a seperate lookup table may give you a better performance, testing is
the best way to determine. The lookup table could have an numeric value
that corresponds to active, pending, inactive and then you store the numeric
value in your main table. You wouldn't necessarily have to join to the
lookup table, you could just say WHERE Status = 1.

Using lookup tables can be more flexible for front-end coding because if
you have additions to your lookup choices you can simply edit the table
rather than digging around in the front-end code.

I wouldn't think a user-defined datatype would be useful for this.

hth|||nick (nickgieschen@.hotmail.com) writes:
> I'm pretty much a database beginner and have what I think is a basic
> question:
> If I have a table which has a 'status' column and I can have say three
> statuses: "active", "pending", "inactive". Is it better to break these
> out into a different "Statuses" table?
> On the one hand it seems to me it would be better to be in a different
> table since I'll index this column because I'll be in a where clause
> sometimes and I think indexing it would be easier than indexing the
> actual words. On the other hand, are joins going to slow queries down
> too much? I read something about creating my own sql server 2000
> datatype - would this be a good place to do such a thing?

Basic question? It is actually one that I run into when I'm database design
every now and when, and the answer is not always the same. Mainly it is a
judgement's call. But these days, I tend to go for the table.

I like to first point that when I decide whether to add a table, or to
just have a column with some distinct values, performance has none to with
that decision. More important is the aspect of maintenance, the possibility
to present the value, extensibility and whether the value is important
enough to deserve a table.

Having a single column like:

status chat(1) NOT NULL CHECK (status IN ('A', 'P', 'I'))

has the advantage that it's up little space in the documentation, and
so easier to grasp. But if the value is to be presented in a GUI, the
GUI gets responsible for doing the translation (or the user gets to see
A, P and I. Another issue, is whether you need to add a new value. For
various reasons when we change tables, our standard routine is to take
the long way and reload the data into a new table. A bit expensive for
a changed CHECK constraint.

If you have a column with a lookup-table like:

status char(1) NOT NULL REFERENCES statusvalues (status)

this is more work for me initially, because I have to create an INSERT-
file with the statusvalues, and there is one more table in the database.
(In our case actually two, because there would also be a name table
that gives translations in different languages.). But if I later need
to add a new value, it's just a matter of changing that INSERT-file and
no need to reload the table. And with all strings in the database, the
GUI gets a simpler job.

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

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

basic question for sp

Hi,
I need to write a sp. In the sp first I do a select statement (select cycle
from table where ... ) it only returns a single value. and the rest of the s
p
will do different select based the value. how can assign the result to a
varable? ThanksJen,
Try:
DECLARE @.MYVAR INT --OR CHAR OR VARCHAR OR...DEPENDING ON VALUE
SELECT @.MYVAR = COL FROM...
HTH
Jerry
"Jen" <Jen@.discussions.microsoft.com> wrote in message
news:CB644854-6C94-48BC-8E45-9DC9A959F0C5@.microsoft.com...
> Hi,
> I need to write a sp. In the sp first I do a select statement (select
> cycle
> from table where ... ) it only returns a single value. and the rest of the
> sp
> will do different select based the value. how can assign the result to a
> varable? Thanks|||Something along the lines of:
SET @.var = ( SELECT ... ) ;
You will have to make sure the select statement returns a single value or
you will get an error.
Anith|||DECLARE @.Variable <type>
SELECT @.Variable = cycle FROM table WHERE ...
John Scragg
"Jen" wrote:

> Hi,
> I need to write a sp. In the sp first I do a select statement (select cycl
e
> from table where ... ) it only returns a single value. and the rest of the
sp
> will do different select based the value. how can assign the result to a
> varable? Thankssql

Basic question about replication

Hi,
I am a newbie to replication. I recently joined a company where I have a SQL
Server running 2000 SP3 and I see a distribution database and Replication
Monitor in the Enterprise Manager.
On going to Tools->Replication ->Configure Publishing, Subscribers and
Distribution a pop-up window comes up. In this window under the Publishers
tab, the name of the Server comes up as selected. In the subscribers tab an
ODBC data source is selected. However, in the Publications database tab, NO
database name is checked.
I want to delete the distribution database. Can I safely assume that no
replication is taking place, since no database has been selected for
replication? Or is there a way to find out if any replication is taking
place? Thanks in advance.Hi,
I am not sure but you can check this by executing
sp_helpreplicationoption
Shows the types of replication options enabled for a server. This stored
procedure is executed at the Publisher on the publication database. Take help
of books onile also.
Manu
"sharman" wrote:
> Hi,
> I am a newbie to replication. I recently joined a company where I have a SQL
> Server running 2000 SP3 and I see a distribution database and Replication
> Monitor in the Enterprise Manager.
> On going to Tools->Replication ->Configure Publishing, Subscribers and
> Distribution a pop-up window comes up. In this window under the Publishers
> tab, the name of the Server comes up as selected. In the subscribers tab an
> ODBC data source is selected. However, in the Publications database tab, NO
> database name is checked.
> I want to delete the distribution database. Can I safely assume that no
> replication is taking place, since no database has been selected for
> replication? Or is there a way to find out if any replication is taking
> place? Thanks in advance.
>

Basic Question about password and logon command

I have running SQL queries all day and have been getting tired of selecting the DATA SOURCE NAME and then having to type in the appropriate password. What can I add to my SQL command to do this for me?
Thanks for the help!
NormDo you mean like a connect line in your script?|||Originally posted by exdter
Do you mean like a connect line in your script?

Yes, exactly|||Is this what you mean?
The first line of your script should be
conn[ect] user/password/database
The problem with this is that your password won't be encrypted, so someone can see it.
I hope this helps.|||Originally posted by exdter
Is this what you mean?
The first line of your script should be
conn[ect] user/password/database
The problem with this is that your password won't be encrypted, so someone can see it.
I hope this helps.

Forgive my ignorance but I don't think I asked for the right thing.

Here's what I'm looking at....

I'm in Access and I run an SQL query such as:

select COUNT(*) from employee_data where title = 'Programmer'

and the next thing you know is a window pops up where I need to click on the "Machine Data Source" tab and then the appropriate "Data Source Name" which then has me type in my password.

Thanks for the help.

Norm|||Oh, sorry. I can't help with that one.
I don't know Access.

Basic Question - Truncate Log

Hello Experts
We just started using SQL Server 7.0 in our organization which had come
along with BackOffice with NT 4.0. We have just started putting in some data
in it and have created some tables and some relationships.
My Question is
Should One Truncate Log?
If Yes When Should it be done?
Would appreciate your suggestions on this - THANKS in advance
Regards
Manish Sawjiani
Three Cheers to Technet for the Help!
I suggest you start with Tibor's aricle:
http://www.karaszi.com/sqlserver/info_dont_shrink.asp
-oj
"Manish Sawjiani" <ManishSawjiani@.discussions.microsoft.com> wrote in
message news:24CEF98E-AF48-4707-BA94-1AF01E796BAE@.microsoft.com...
> Hello Experts
> We just started using SQL Server 7.0 in our organization which had come
> along with BackOffice with NT 4.0. We have just started putting in some
> data
> in it and have created some tables and some relationships.
> My Question is
> Should One Truncate Log?
> If Yes When Should it be done?
> Would appreciate your suggestions on this - THANKS in advance
> Regards
> Manish Sawjiani
> --
> Three Cheers to Technet for the Help!
|||Hi,
If it is not production database you could set the database option "Truncate
Log on Checkpoint". This will clear the Transaction log byy may itself.
If it is a production database or if the data is critical then you can not
enable the Truncate log on checkpoint option. Instead of that you have to
perform
Transaction log backup (See BACKUP LOG in books online). After the
Trasnaction log backup Log will be automatically cleared.
Thanks
Hari
SQL Server DBA
"Manish Sawjiani" <ManishSawjiani@.discussions.microsoft.com> wrote in
message news:24CEF98E-AF48-4707-BA94-1AF01E796BAE@.microsoft.com...
> Hello Experts
> We just started using SQL Server 7.0 in our organization which had come
> along with BackOffice with NT 4.0. We have just started putting in some
> data
> in it and have created some tables and some relationships.
> My Question is
> Should One Truncate Log?
> If Yes When Should it be done?
> Would appreciate your suggestions on this - THANKS in advance
> Regards
> Manish Sawjiani
> --
> Three Cheers to Technet for the Help!

Basic Question - Truncate Log

Hello Experts
We just started using SQL Server 7.0 in our organization which had come
along with BackOffice with NT 4.0. We have just started putting in some data
in it and have created some tables and some relationships.
My Question is
Should One Truncate Log?
If Yes When Should it be done?
Would appreciate your suggestions on this - THANKS in advance
Regards
Manish Sawjiani
--
Three Cheers to Technet for the Help!I suggest you start with Tibor's aricle:
http://www.karaszi.com/sqlserver/info_dont_shrink.asp
--
-oj
"Manish Sawjiani" <ManishSawjiani@.discussions.microsoft.com> wrote in
message news:24CEF98E-AF48-4707-BA94-1AF01E796BAE@.microsoft.com...
> Hello Experts
> We just started using SQL Server 7.0 in our organization which had come
> along with BackOffice with NT 4.0. We have just started putting in some
> data
> in it and have created some tables and some relationships.
> My Question is
> Should One Truncate Log?
> If Yes When Should it be done?
> Would appreciate your suggestions on this - THANKS in advance
> Regards
> Manish Sawjiani
> --
> Three Cheers to Technet for the Help!|||Hi,
If it is not production database you could set the database option "Truncate
Log on Checkpoint". This will clear the Transaction log byy may itself.
If it is a production database or if the data is critical then you can not
enable the Truncate log on checkpoint option. Instead of that you have to
perform
Transaction log backup (See BACKUP LOG in books online). After the
Trasnaction log backup Log will be automatically cleared.
Thanks
Hari
SQL Server DBA
"Manish Sawjiani" <ManishSawjiani@.discussions.microsoft.com> wrote in
message news:24CEF98E-AF48-4707-BA94-1AF01E796BAE@.microsoft.com...
> Hello Experts
> We just started using SQL Server 7.0 in our organization which had come
> along with BackOffice with NT 4.0. We have just started putting in some
> data
> in it and have created some tables and some relationships.
> My Question is
> Should One Truncate Log?
> If Yes When Should it be done?
> Would appreciate your suggestions on this - THANKS in advance
> Regards
> Manish Sawjiani
> --
> Three Cheers to Technet for the Help!

Basic Question - Truncate Log

Hello Experts
We just started using SQL Server 7.0 in our organization which had come
along with BackOffice with NT 4.0. We have just started putting in some data
in it and have created some tables and some relationships.
My Question is
Should One Truncate Log?
If Yes When Should it be done?
Would appreciate your suggestions on this - THANKS in advance
Regards
Manish Sawjiani
--
Three Cheers to technet for the Help!I suggest you start with Tibor's aricle:
http://www.karaszi.com/sqlserver/info_dont_shrink.asp
-oj
"Manish Sawjiani" <ManishSawjiani@.discussions.microsoft.com> wrote in
message news:24CEF98E-AF48-4707-BA94-1AF01E796BAE@.microsoft.com...
> Hello Experts
> We just started using SQL Server 7.0 in our organization which had come
> along with BackOffice with NT 4.0. We have just started putting in some
> data
> in it and have created some tables and some relationships.
> My Question is
> Should One Truncate Log?
> If Yes When Should it be done?
> Would appreciate your suggestions on this - THANKS in advance
> Regards
> Manish Sawjiani
> --
> Three Cheers to technet for the Help!|||Hi,
If it is not production database you could set the database option "Truncate
Log on Checkpoint". This will clear the Transaction log byy may itself.
If it is a production database or if the data is critical then you can not
enable the Truncate log on checkpoint option. Instead of that you have to
perform
Transaction log backup (See BACKUP LOG in books online). After the
Trasnaction log backup Log will be automatically cleared.
Thanks
Hari
SQL Server DBA
"Manish Sawjiani" <ManishSawjiani@.discussions.microsoft.com> wrote in
message news:24CEF98E-AF48-4707-BA94-1AF01E796BAE@.microsoft.com...
> Hello Experts
> We just started using SQL Server 7.0 in our organization which had come
> along with BackOffice with NT 4.0. We have just started putting in some
> data
> in it and have created some tables and some relationships.
> My Question is
> Should One Truncate Log?
> If Yes When Should it be done?
> Would appreciate your suggestions on this - THANKS in advance
> Regards
> Manish Sawjiani
> --
> Three Cheers to technet for the Help!sql

Basic Question - Push & Pull subscription

Paul/Hillary;
Scenario:
servers in the same domain:
Create the publisher/distributor
Create publication "MyPublication"
Create push subscription to Server B "PushToB"
Logon onto Server B
Create Pull Subscription "PullFromA"
Cannot create Pull Subscription...
A quick google search and I find
"When you create a pull subscription and a push subscription for the
publication already exists for the Subscriber, an error message informs you
that the push subscription already exists and that you should drop any push
subscriptions before proceeding. When you create a pull subscription, and
another pull subscription to the same publication already exists, you will be
required to drop the existing subscription before adding the new one unless
the first subscription has expired."
Logon to Publisher
Delete Push subscription "PushToB" on publisher
logon to subscriber
Create Pull subscription "PullFromA" on subscriber
logon to publisher
Create Push subscription "PushToB" on publisher
Push subscription fails....
When I create a publication for each on the publisher, it works.
What am I missing?
MJ
Hi Pual;
No, you are dealing with ignorance on my end (thank you for your patience).
Context:
I need to changes at the publisher to push to the subscriber
I then need changes at the subscriber to push to the publisher.
Test envrironment Solution:
I set up a merge publication on the publisher then loged onto the
subscriber and created a pull subscription. Every thing is fine.
this is sql server 2000.
My biggest challenge has been reading so many sources and I am getting
confused:
Microsofts "Patterns and Practices" Data Patterns
Microsoft's High Availablitity Volume 1 and Volume 2
Hillary's "Transaction ad Snapshot"
I even pleaded Hillary to publish his promised 2nd book on Merge Replication.
"Paul Ibison" wrote:

> I'm not sure I follow. You are restricted from having a pull and push on the
> subscriber to the same publication and the same subscriber database. Your
> scenario arrives at this same point each time but in a different order
> (pushtob is still created after pullfroma) - or am I misreading something
> here.
> Cheers,
> Paul Ibison
>
>
|||Question: Merge or Transactional bidirectional replication?
I am looking for a Bi-directional merge replication solution
Does the subscriber go offline? Yes
Does the subscriber modify the same data as the publisher? Yes
What happens when they conflict (assuming the subscriber isn't connected to
the publisher)? Publisher has ultimate determination.
How many subscribers do you have?
A vague answer is 12
A better answer is I use a filter and create a separate publication for each.
Do the subscribers need to be distinguished? Yes
"Paul Ibison" wrote:

> OK - I see. The term Push and Pull refer to where the work is being done
> (simplified a bit). The actual work remains the same, so you need either a
> push or a pull subscription but not both. If you want bidirectional
> replication then the choice usually is between merge and transactional. The
> latter can be queued, immediate updating or bidirectional or peer-to-peer.
> Many posibilities here. Some questions will help narrow down a bit. Does the
> subscriber go offline? Does the subscriber modify the same data as the
> publisher? What happens when they conflict (assuming the subscriber isn't
> connected tot he publisher). How many subscribers do you have? Do the
> subscribers need to be distinguished?
> If you have clear answers to these questions and hopefully I've not left too
> many out, then we can probably tell you exactly what type of replication you
> need
> HTH,
> Paul Ibison
>
>
|||Thank you for patience and dedication from a dedicated Ibison and Cotter
follower.
MJ
"Paul Ibison" wrote:

> OK - it sounds like merge is your best option then. You don't necessarily
> need a separate publication per subscriber - dynamic subscriptions might do
> the trick for you.
> HTH,
> Paul Ibison
>
>
>

Basic question - no one has the answer?

Hi,

I know the difference between char and varchar but there is conflicting advice from professionals about which one to use. In the case of a customer table (name of company, address etc) some professionals say use char because it will only occupy x amount of space and therefore querys will run faster because sql server does not need to check the length of each field. Others say use varchar because then there is no wasted space (seems obvious).

Could anyone give me a description of why one is prefered over another?

Thanks,

MarkSpeed will be required more for data path access...anything else is probably inconsequental...

Sorry, still didn't give you an answer...

But all development I've ever seen usually uses varchar...but I probably wouldn't say varchar(5) or something...

All of Oracle is varchar2...except char(1)

BOL was of no help...

I'll give it a google...|||http://p2p.wrox.com/archive/sql_server/2001-04/101.asp

Says almost the same thing...

you can test it though...load up 2 identical tables and do some metrics

If you're selecting lots of data it may be a problem...but you should use bcp in that case anyway.|||Here check this site out...

It's a research team the paired up with MS. They use SQL Server..

anyway, they are mapping the entire nights sky.. I think they claim the database to be at 888GB right now...

The even let you see their catalog on line...seems everything is varchar

have a look

http://skyserver.sdss.org/en/help/browser/browser.asp|||Ok Brett,

Thanks for the help and advice. You mentioned metrics. Do you know of any free software that can give performance metrics for sql?

Many thanks,

Mark

Originally posted by Brett Kaiser
Speed will be required more for data path access...anything else is probably inconsequental...

Sorry, still didn't give you an answer...

But all development I've ever seen usually uses varchar...but I probably wouldn't say varchar(5) or something...

All of Oracle is varchar2...except char(1)

BOL was of no help...

I'll give it a google...|||Yeah,

SQL Server itself...

Build 2 tables that are identical except for the datatype differences you want to check out

Create a while loop to populate with data for n times...yiou probably want to check it out for small medium and large row sets.

Create a set of sql scripts to access the data in different ways and manners..

set show stats and show plans in QA

Start a trace with profiler...

execute the 2 scripts in two different windows...

do them seaparately at first..then run them against each other...

Si?|||Ok Brett,

Thanks for the info,

Mark

Originally posted by Brett Kaiser
Yeah,

SQL Server itself...

Build 2 tables that are identical except for the datatype differences you want to check out

Create a while loop to populate with data for n times...yiou probably want to check it out for small medium and large row sets.

Create a set of sql scripts to access the data in different ways and manners..

set show stats and show plans in QA

Start a trace with profiler...

execute the 2 scripts in two different windows...

do them seaparately at first..then run them against each other...

Si?|||1 major think that to take into consideration is:

Does your column allow nullable values?

If yes, then it is better not to have it as char. Because char datatype counts null as a storage value.

e.g. if u declare char(1000) a null colum will store 1000 bytes of null data.

If any of u still haven't thought of it from this angle!|||Just my .02, if you will have to do any string manipulation, use varchar.

Depending on the type of queries you will be running, char gives a predictable placing on the 8kb data page which may result in less logical IO.

I usually use varchar unless I know there will be no nulls and it's a guaranteed length (like state abbreviations)

HTH|||Ok,

Many thanks for the advice

Originally posted by rhigdon
Just my .02, if you will have to do any string manipulation, use varchar.

Depending on the type of queries you will be running, char gives a predictable placing on the 8kb data page which may result in less logical IO.

I usually use varchar unless I know there will be no nulls and it's a guaranteed length (like state abbreviations)

HTH

Basic Question

We want to set up another office as an online disaster recovery site. Can I
clister between two SQL servers over a T1?
Your best bet is using third party software, though you might be able to use
MNS (Majority Node Set). Have you looked into Log Shipping with SQL?
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Rick Vines" <Rick Vines@.discussions.microsoft.com> wrote in message
news:640BDCB1-F523-4B21-AF91-AB24D58D2DCD@.microsoft.com...
> We want to set up another office as an online disaster recovery site. Can
> I
> clister between two SQL servers over a T1?

basic question

hi i have the following variables.
declare @.viStock int
set @.viStock = 1000
declare @.vdStartDate datetime
declare @.vdEndDate datetime
set @.vdStartDate = getdate()
set @.vdEndDate = dateadd(w, 10, getdate())
i want to insert into a temp ttable the following
amount date
100 24-10-2005
100 31-11-2005
100 31-11-2005
.. and so on for 10 ws.
where amount = stock / @.vdStartDate - @.vdEndDate
how do i do this so that the amount is equally divided?
thankshere is the schema.
--
-- drop table temp
-- create table temp
-- (
-- amt int,
-- date datetime
-- )
--
declare @.viStock int
set @.viStock = 1000
declare @.vdStartDate datetime
declare @.vdEndDate datetime
set @.vdStartDate = getdate()
set @.vdEndDate = dateadd(w, 10, getdate())
insert into temp
(amt,date)
(
select @.viStock / datediff([w], @.vdStartDate, @.vdEndDate),
dateadd([w], 1, @.vdEndDate)
--group by @.viStock/ datediff(w, @.vdStartDate, @.vdEndDate), dateadd(w,
1, @.vdEndDate))
)
select * From temp
delete from temp
i cant use a group by here says -Server: Msg 164, Level 15, State 1, Line 20
GROUP BY expressions must refer to column names that appear in the select
list.
how do i correct that?
thanks
"ichor" <ichor@.hotmail.com> wrote in message
news:eJJ2wST2FHA.2564@.TK2MSFTNGP10.phx.gbl...
> hi i have the following variables.
> declare @.viStock int
> set @.viStock = 1000
> declare @.vdStartDate datetime
> declare @.vdEndDate datetime
> set @.vdStartDate = getdate()
> set @.vdEndDate = dateadd(w, 10, getdate())
>
> i want to insert into a temp ttable the following
> amount date
> 100 24-10-2005
> 100 31-11-2005
> 100 31-11-2005
> .. and so on for 10 ws.
> where amount = stock / @.vdStartDate - @.vdEndDate
> how do i do this so that the amount is equally divided?
>
> thanks
>|||On Tue, 25 Oct 2005 17:21:15 +1000, ichor wrote:

>hi i have the following variables.
>declare @.viStock int
>set @.viStock = 1000
>declare @.vdStartDate datetime
>declare @.vdEndDate datetime
>set @.vdStartDate = getdate()
>set @.vdEndDate = dateadd(w, 10, getdate())
>
>i want to insert into a temp ttable the following
>amount date
>100 24-10-2005
>100 31-11-2005
>100 31-11-2005
>.. and so on for 10 ws.
>where amount = stock / @.vdStartDate - @.vdEndDate
>how do i do this so that the amount is equally divided?
Hi ichor,
First step is to create and fill a numbers table. This is a one-time
job, and you'll find that there are many uses for a umbers table. Check
out http://www.aspfaq.com/show.asp?id=2516 for details on how to make a
numbers table and some examples of how to use it.
Now to the actual query:
SET @.NumWs = DATEDIFF(w, @.vdStartDate, @.vdEndDate)
INSERT INTO temptable (amount, [date])
SELECT @.viStock / @.NumWs,
DATEADD(w, Number-1, @.vdStartDate)
FROM Numbers
WHERE Number BETWEEN 1 AND @.NumWs
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)