Showing posts with label creating. Show all posts
Showing posts with label creating. Show all posts

Thursday, March 29, 2012

Duplicate SQL Server entry

When creating a new data source for SQL Server, there is one server
that shows up twice in the list. Could this cause any problems, and
how do I remove the duplicate entry?Are you referring to the ODBC datasource list? It shouldn't be a problem.
--
Anith

Duplicate Server Name When Creating ODBC

When creating a SQL Server ODBC connection via Data Source applet on a WXP
workstation, when clicking the drop down menu to select the server, two
instances of the same server appear. We recently migrated our SQL server to
new hardware. Turned off the old server and gave the new server the same name
and IP. Also renamed the instance of SQL on the server to the old name. I am
sure this is the cause but not sure how to remove the duplicate entry on the
workstation. We are only seeing this on one workstation? Thanks for your
feedback.
netwerktek
On this computer do the following:
Go to Start - Run
Type in cliconfg and click OK
This will start the Client Network Utility
Go to the Alias tab
There should be an alias defined for this server
Delete the alias. this the where the second entry is coming from.
(Before deleting note the properties. You may need to add it back if
connections fail after deleting it.)
Rand
This posting is provided "as is" with no warranties and confers no rights.
|||That did it. Thank you very much!
"Rand Boyd [MSFT]" wrote:

> On this computer do the following:
> Go to Start - Run
> Type in cliconfg and click OK
> This will start the Client Network Utility
> Go to the Alias tab
> There should be an alias defined for this server
> Delete the alias. this the where the second entry is coming from.
> (Before deleting note the properties. You may need to add it back if
> connections fail after deleting it.)
> Rand
> This posting is provided "as is" with no warranties and confers no rights.
>

Duplicate Server Name When Creating ODBC

When creating a SQL Server ODBC connection via Data Source applet on a WXP
workstation, when clicking the drop down menu to select the server, two
instances of the same server appear. We recently migrated our SQL server to
new hardware. Turned off the old server and gave the new server the same nam
e
and IP. Also renamed the instance of SQL on the server to the old name. I am
sure this is the cause but not sure how to remove the duplicate entry on the
workstation. We are only seeing this on one workstation? Thanks for your
feedback.
--
netwerktekOn this computer do the following:
Go to Start - Run
Type in cliconfg and click OK
This will start the Client Network Utility
Go to the Alias tab
There should be an alias defined for this server
Delete the alias. this the where the second entry is coming from.
(Before deleting note the properties. You may need to add it back if
connections fail after deleting it.)
Rand
This posting is provided "as is" with no warranties and confers no rights.|||That did it. Thank you very much!
"Rand Boyd [MSFT]" wrote:

> On this computer do the following:
> Go to Start - Run
> Type in cliconfg and click OK
> This will start the Client Network Utility
> Go to the Alias tab
> There should be an alias defined for this server
> Delete the alias. this the where the second entry is coming from.
> (Before deleting note the properties. You may need to add it back if
> connections fail after deleting it.)
> Rand
> This posting is provided "as is" with no warranties and confers no rights.
>

Monday, March 26, 2012

Duplicate inserts creating an error

Strange issue (aren't they all). On my VB.Net app, I use merge replication.
Everything appears correct with synchronization and data flows in both
directions. However, I have noticed that on the SQLCE tables where I do
multiple Inserts, I'm now getting an error after the second synchronization.
For example, I do a download of the data, do Inserts on some of the tables,
then merge upload the data to the server. Now I go back for a second
download, and when I try to do an Insert, I get the error, "A duplicate
value cannot be inserted into a unique index".
I'm not trying to insert a primary key or into a primary key field, and I've
deleted all the indexes on any other fields -- except the uniqueID fields
created by the publication creation.
Not sure where I'm going astray here, so any advice would be appreciated.
Which table are you getting this error on? Is it a system table or a user
table?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
|||User tables on the PocketPC.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:opsoxx6ntqrj9kur@.hcottter-lap.ap.org...
> Which table are you getting this error on? Is it a system table or a user
> table?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com

Monday, March 19, 2012

Dump database objects without owners

Dear Friends,
Sql Server 2000
While creating the database script using EM
right-click the database to script, point to All
Tasks, and then click Generate SQL Scripts.
This creates a script with owner of the objects, like
CREATE TABLE [usera].[tbl_wi_lookup] (
[wi_lookup_id] [int] IDENTITY (1, 1) NOT NULL ,
[wi_lookup_type] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[wi_lookup_value] [varchar] (100) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
But i want to create a script without the user of the
object.
In the development machine the user 'A' owns all the
tables and scripts. I want to give the script file to
the client who may use user 'A' or User 'B' or user
'sa'.
So i want to dump the database objects without owner
information. Is there anyway to get such ddl ?
Please shed some light.
Kumar
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!I would simply open the file in a text editor and replace lit...
Unsophisticated , but done!...
As an aside, it is generally a bad idea to allow any individuals, other than
the DBO to own objects inthe database... It leads to performance issues,
code maintenance issues, etc - the first of which you see here... If DBO
owned all of the tables, you could merely generate the script and run it...
The DBO in each database could be different, and there would be no impact on
the scripting..\\\\\
Hope this helps.
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.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
"kumar ss" <sgnerd@.yahoo.com.sg> wrote in message
news:Ou9judkFEHA.3188@.TK2MSFTNGP09.phx.gbl...
> Dear Friends,
> Sql Server 2000
> While creating the database script using EM
> right-click the database to script, point to All
> Tasks, and then click Generate SQL Scripts.
> This creates a script with owner of the objects, like
> CREATE TABLE [usera].[tbl_wi_lookup] (
> [wi_lookup_id] [int] IDENTITY (1, 1) NOT NULL ,
> [wi_lookup_type] [varchar] (50) COLLATE
> SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [wi_lookup_value] [varchar] (100) COLLATE
> SQL_Latin1_General_CP1_CI_AS NULL
> ) ON [PRIMARY]
> GO
> But i want to create a script without the user of the
> object.
> In the development machine the user 'A' owns all the
> tables and scripts. I want to give the script file to
> the client who may use user 'A' or User 'B' or user
> 'sa'.
> So i want to dump the database objects without owner
> information. Is there anyway to get such ddl ?
> Please shed some light.
> Kumar
>
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!|||Hi,
There is a stored procedure in the below link using SQL DMO, which will be
suit your requirement.
http://www.mssqlcity.com/Scripts/T-...erateScript.sql
Thanks
Hari
MCDBA
"kumar ss" <sgnerd@.yahoo.com.sg> wrote in message
news:Ou9judkFEHA.3188@.TK2MSFTNGP09.phx.gbl...
> Dear Friends,
> Sql Server 2000
> While creating the database script using EM
> right-click the database to script, point to All
> Tasks, and then click Generate SQL Scripts.
> This creates a script with owner of the objects, like
> CREATE TABLE [usera].[tbl_wi_lookup] (
> [wi_lookup_id] [int] IDENTITY (1, 1) NOT NULL ,
> [wi_lookup_type] [varchar] (50) COLLATE
> SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [wi_lookup_value] [varchar] (100) COLLATE
> SQL_Latin1_General_CP1_CI_AS NULL
> ) ON [PRIMARY]
> GO
> But i want to create a script without the user of the
> object.
> In the development machine the user 'A' owns all the
> tables and scripts. I want to give the script file to
> the client who may use user 'A' or User 'B' or user
> 'sa'.
> So i want to dump the database objects without owner
> information. Is there anyway to get such ddl ?
> Please shed some light.
> Kumar
>
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!|||EM scripting is not very customizable, I'm afraid. Query Analyzer has that o
ption, though (but you can only
script one object at a time in QA). I imagine that some of below tools also
has that option:
http://www.karaszi.com/sqlserver/in...rate_script.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"kumar ss" <sgnerd@.yahoo.com.sg> wrote in message news:Ou9judkFEHA.3188@.TK2MSFTNGP09.phx.gb
l...
> Dear Friends,
> Sql Server 2000
> While creating the database script using EM
> right-click the database to script, point to All
> Tasks, and then click Generate SQL Scripts.
> This creates a script with owner of the objects, like
> CREATE TABLE [usera].[tbl_wi_lookup] (
> [wi_lookup_id] [int] IDENTITY (1, 1) NOT NULL ,
> [wi_lookup_type] [varchar] (50) COLLATE
> SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [wi_lookup_value] [varchar] (100) COLLATE
> SQL_Latin1_General_CP1_CI_AS NULL
> ) ON [PRIMARY]
> GO
> But i want to create a script without the user of the
> object.
> In the development machine the user 'A' owns all the
> tables and scripts. I want to give the script file to
> the client who may use user 'A' or User 'B' or user
> 'sa'.
> So i want to dump the database objects without owner
> information. Is there anyway to get such ddl ?
> Please shed some light.
> Kumar
>
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

Sunday, March 11, 2012

Dumb index question

If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
indexes?
Even if it only creates one compound index, if I run the query: select *
from tab1 where col1 = x
Will it still use the compound index, if nothing better is available,
because the column heads the index.
I am expecting the answer to be: 2 indexes and Duh/yes!On Wed, 15 Aug 2007 16:42:16 -0700, "Jay" <nospam@.nospam.org> wrote:

>If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
>another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
>indexes?
>Even if it only creates one compound index, if I run the query: select *
>from tab1 where col1 = x
>Will it still use the compound index, if nothing better is available,
>because the column heads the index.
>
>I am expecting the answer to be: 2 indexes and Duh/yes!
A compound index is one index, so if the only index you create is a
two column primary key there is one index. A foreign key is a good
candidate for an index, but no index ix created just because of a FK
definition. Only a PK definition creates an index.
A multi-column index can be used if at least the left-most column is
provided to search on. So in your example of a compound PK on
tab1(col1, col2), the query SELECT * FROM tab1 WHERE col1 = 'x' can
use the index.
Roy Harvey
Beacon Falls, CT|||In addition to Roy's answer , try to avoid using SELECT * in production
environment.
Always specify columns that you need to return. For example if you run
SELECT col1,col2 FROM tbl WHERE col2='blblbl' then SQL Server will create
most fate execution plan as your index covers columns in SELECT statement.
But if you run SELECT col10 FROM tbl WHERE col2='blblbl' will use bookmark
to clustered index key (contains data) to return the data from col10 which
is not part of index
Just my two cenys
"Jay" <nospam@.nospam.org> wrote in message
news:e9LqqX53HHA.600@.TK2MSFTNGP05.phx.gbl...
> If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
> another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
> indexes?
> Even if it only creates one compound index, if I run the query: select *
> from tab1 where col1 = x
> Will it still use the compound index, if nothing better is available,
> because the column heads the index.
>
> I am expecting the answer to be: 2 indexes and Duh/yes!
>|||On Aug 15, 6:42 pm, "Jay" <nos...@.nospam.org> wrote:
> If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
> another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
> indexes?
> Even if it only creates one compound index, if I run the query: select *
> from tab1 where col1 = x
> Will it still use the compound index, if nothing better is available,
> because the column heads the index.
> I am expecting the answer to be: 2 indexes and Duh/yes!
It is very easy to see for yourself. Create a FK constraint and see if
it created an index. You may use GUI or select from system views such
as sysindexes and sysindexkeys.
Alex Kuznetsov, SQL Server MVP
http://sqlserver-tips.blogspot.com/

Dumb index question

If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
indexes?
Even if it only creates one compound index, if I run the query: select *
from tab1 where col1 = x
Will it still use the compound index, if nothing better is available,
because the column heads the index.
I am expecting the answer to be: 2 indexes and Duh/yes!
On Wed, 15 Aug 2007 16:42:16 -0700, "Jay" <nospam@.nospam.org> wrote:

>If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
>another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
>indexes?
>Even if it only creates one compound index, if I run the query: select *
>from tab1 where col1 = x
>Will it still use the compound index, if nothing better is available,
>because the column heads the index.
>
>I am expecting the answer to be: 2 indexes and Duh/yes!
A compound index is one index, so if the only index you create is a
two column primary key there is one index. A foreign key is a good
candidate for an index, but no index ix created just because of a FK
definition. Only a PK definition creates an index.
A multi-column index can be used if at least the left-most column is
provided to search on. So in your example of a compound PK on
tab1(col1, col2), the query SELECT * FROM tab1 WHERE col1 = 'x' can
use the index.
Roy Harvey
Beacon Falls, CT
|||In addition to Roy's answer , try to avoid using SELECT * in production
environment.
Always specify columns that you need to return. For example if you run
SELECT col1,col2 FROM tbl WHERE col2='blblbl' then SQL Server will create
most fate execution plan as your index covers columns in SELECT statement.
But if you run SELECT col10 FROM tbl WHERE col2='blblbl' will use bookmark
to clustered index key (contains data) to return the data from col10 which
is not part of index
Just my two cenys
"Jay" <nospam@.nospam.org> wrote in message
news:e9LqqX53HHA.600@.TK2MSFTNGP05.phx.gbl...
> If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
> another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
> indexes?
> Even if it only creates one compound index, if I run the query: select *
> from tab1 where col1 = x
> Will it still use the compound index, if nothing better is available,
> because the column heads the index.
>
> I am expecting the answer to be: 2 indexes and Duh/yes!
>
|||On Aug 15, 6:42 pm, "Jay" <nos...@.nospam.org> wrote:
> If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
> another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
> indexes?
> Even if it only creates one compound index, if I run the query: select *
> from tab1 where col1 = x
> Will it still use the compound index, if nothing better is available,
> because the column heads the index.
> I am expecting the answer to be: 2 indexes and Duh/yes!
It is very easy to see for yourself. Create a FK constraint and see if
it created an index. You may use GUI or select from system views such
as sysindexes and sysindexkeys.
Alex Kuznetsov, SQL Server MVP
http://sqlserver-tips.blogspot.com/

Dumb index question

If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
indexes?
Even if it only creates one compound index, if I run the query: select *
from tab1 where col1 = x
Will it still use the compound index, if nothing better is available,
because the column heads the index.
I am expecting the answer to be: 2 indexes and Duh/yes!On Wed, 15 Aug 2007 16:42:16 -0700, "Jay" <nospam@.nospam.org> wrote:
>If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
>another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
>indexes?
>Even if it only creates one compound index, if I run the query: select *
>from tab1 where col1 = x
>Will it still use the compound index, if nothing better is available,
>because the column heads the index.
>
>I am expecting the answer to be: 2 indexes and Duh/yes!
A compound index is one index, so if the only index you create is a
two column primary key there is one index. A foreign key is a good
candidate for an index, but no index ix created just because of a FK
definition. Only a PK definition creates an index.
A multi-column index can be used if at least the left-most column is
provided to search on. So in your example of a compound PK on
tab1(col1, col2), the query SELECT * FROM tab1 WHERE col1 = 'x' can
use the index.
Roy Harvey
Beacon Falls, CT|||In addition to Roy's answer , try to avoid using SELECT * in production
environment.
Always specify columns that you need to return. For example if you run
SELECT col1,col2 FROM tbl WHERE col2='blblbl' then SQL Server will create
most fate execution plan as your index covers columns in SELECT statement.
But if you run SELECT col10 FROM tbl WHERE col2='blblbl' will use bookmark
to clustered index key (contains data) to return the data from col10 which
is not part of index
Just my two cenys
"Jay" <nospam@.nospam.org> wrote in message
news:e9LqqX53HHA.600@.TK2MSFTNGP05.phx.gbl...
> If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
> another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
> indexes?
> Even if it only creates one compound index, if I run the query: select *
> from tab1 where col1 = x
> Will it still use the compound index, if nothing better is available,
> because the column heads the index.
>
> I am expecting the answer to be: 2 indexes and Duh/yes!
>|||On Aug 15, 6:42 pm, "Jay" <nos...@.nospam.org> wrote:
> If I create a compound PK on tab1(col1, col2) where col1 is also a FK to
> another table, is SQL Server 2000 (or 2005) creating 1, or 2 underlying
> indexes?
> Even if it only creates one compound index, if I run the query: select *
> from tab1 where col1 = x
> Will it still use the compound index, if nothing better is available,
> because the column heads the index.
> I am expecting the answer to be: 2 indexes and Duh/yes!
It is very easy to see for yourself. Create a FK constraint and see if
it created an index. You may use GUI or select from system views such
as sysindexes and sysindexkeys.
Alex Kuznetsov, SQL Server MVP
http://sqlserver-tips.blogspot.com/