Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Replication / December 2005

Tip: Looking for answers? Try searching our database.

"Select *" in Replication Tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SouRa - 30 Dec 2005 04:25 GMT
Hi,

I used "select * from replicate_table_name" in my stored procedures and my
application.Now i want to replicate that tables.

Will it affect my application and Replication.

Please Advice me.

Regds
Soura
Michael Hotek - 30 Dec 2005 09:44 GMT
It has zero effect on replication, since replication is not going to look at
your code.

It will have no effect on your application as long as you are using
transactional replication.  If you are using any other method of
replication, an additional column will be added to your tables which can
then be picked up by that select * and returned to your application which
might not be expecting it, thereby causing it to blow up.

It is VERY STRONGLY recommended that you do NOT use select * in any code
that you ever write in an application.  It is bad programming practice and
can lead to some very nasty errors after your application is deployed.

Signature

Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com

> Hi,
>
[quoted text clipped - 7 lines]
> Regds
> Soura
Paul Ibison - 30 Dec 2005 14:19 GMT
It depends :). The table schema is modified if you have updatable
subscribers or merge replication - an extra column is added. However, in the
case of merge if you already have a guid column with the rowguid attribute
there won't be another column added.
So, in those cases which cause a schema modification, will the extra column
cause an issue? This depends on your code. In TSQL, if you use:

Insert into x
select * from Y

and Y has an extra column added, it'll fail.

If your code simply does

select * from Y

then it depends on how the recordset/dataset is used in the client app.
There may be some code that iterates through the columns collection which'll
fail if it encounters a new column. Actually this is unlikely as most
columns are referenced directly by name, and the new column will simply
exist but never be referred to.

Anyway - hopefully this gives you some ideas of what to look for to see if
these things will be an issue in your code...

Cheers,
   Paul Ibison SQL Server MVP, www.replicationanswers.com
    (recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.