The Wizard Stole My IDENTITY

Nov 18, 2007

Being new to SQL, I started with the basics... using VS2005, it seemed easy enough. Not a single Sql statement was coded by me, but there I was addding, deleting, updating records like a pro. Relations here, bound objects there, The Wizard was my friend. Then I asked him for what I thought was a very simple request: Can I have my @@IDENTITY please? The Wizard grew angry, and hurled error after error at me, null objects were exploding all around me, I tried to reason with him, offering CType's and Try/Catch's but to no avail. I had to seek help for this monster - one after another telling me to SELECT @@IDENTITY, SELECT SCOPE_IDENTITY, but I pleaded with them "I have for the love of god" everywhere possible (if you find yourself wanting to reply now - my answer is YES I tried that), but he would not reviel my identity... Until I took matters into my own hands....

Wizard Says:
Private Sub MarketLogFilesBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MarketLogFilesBindingNavigatorSaveItem.Click
Me.Validate()
Me.MarketLogFilesBindingSource.EndEdit()
Me.MarketLogFilesTableAdapter.Update(Me.EveMarketDBDataSet.MarketLogFiles)
End Sub

I say:
Private Sub MarketLogFilesBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MarketLogFilesBindingNavigatorSaveItem.Click
Me.Validate()
Me.MarketLogFilesBindingSource.EndEdit()
Dim command As New SqlClient.SqlCommand("SELECT @@IDENTITY", Me.MarketLogFilesTableAdapter.Connection)
Me.MarketLogFilesTableAdapter.Connection.Open()
Me.MarketLogFilesTableAdapter.Update(Me.EveMarketDBDataSet.MarketLogFiles)
Dim i As Integer = CType(command.ExecuteScalar(), Integer) Me.MarketLogFilesTableAdapter.Connection.Close()
End Sub

Though this code may be totally wrong, it works. I spent many hours trying to find a way that didn't involve me writing my own Update commands, or more to the point, I was sure that such a simple task as retriving the last PK of record had to be in the wizards head somewhere. I am sure there is a simple way to do it, that I have so clearly missed, but for those of you who rely on the wizard, the above at least got me one step closer. It seem's in the auto-gen code, the connection is closed after the update command IF the connection was closed BEFORE the update command was issued.

IF ANYONE CAN FIND ME DOCUMENTATION ON THAT FACT, I WILL GIVE YOU ONE MILLION....
Thanks guys, keep up the great work, I love these forums - inspiration and knowledge -

View 2 Replies


ADVERTISEMENT

DTS Wizard SQL 2005 - Enable Identity Insert

Dec 8, 2005

I have a large number of Access tables that I need to periodically bring to SQL using the DTS Wizard in SQL 2000 (via Ent. Man). I am only interested in bring over the data from the MS Access tables as I had a separate script (application drive) that would create the SQL tables.

View 13 Replies View Related

Importing Tables With Identity Properties (uisng Import Wizard)

May 30, 2006

I am using the Import wizard to import a SQL2000 database to SQL2005 and noticed 2 problems:

1. all tables and views were selected; the tables were imported correctly but the views were created as tables, ignoring the "Create view" syntax. The SQL generated contains "Create table" syntax instead of "Create View".

2. when a table contained a column with an "identity" property, the data was successfully imported, but the values for the "identity" column were not preserved, instead they were resquenced from 1 with an increment of 1 (the default values for an identity). When I opened the "Edit" (under "Mapping"), "enable identity insert" was not checked.

A further note: I created all tables in the SQL2005 database before running the Import.

View 4 Replies View Related

Identity Field Settings Not Copied By Import Wizard (2005)

Feb 26, 2006

It appears that when you use the import/export wizard from within Microsoft SQL Server Managment Studio, the identity attributes of the table being copied are not transferred. For example, say the source table has a column

[ref] [int] IDENTITY ( 1 , 1 ) NOT NULL,

When the import wizard is done the destination table will have a column named ref, but will not be an identity column. The column definition will be

[ref] [int] NOT NULL,

instead. Is there a way to change this behavior somewhere in the gui? When doing the import, the only options seems to be 'Enable Identity Insert', but checking this does not affect the definition of the column.

-Eric

View 7 Replies View Related

Importing Data From Oracle 8i/9i To SQL Server 2005 Using SQL Server Import And Export Wizard (AKA DTS Wizard)

Oct 20, 2006

Hi All,

I have become frustrated and I am not finding the answers I expect.

Here's the gist, we support both Oracle and SQL for our product and we would like to migrate our Clients who are willing/requesting to go from Oracle to SQL. Seems easy enough.

So, I create a Database in SQL 2005, right click and select "Import Data", Source is Microsoft OLE DB Provider for Oracle and I setup my connection. so far so good.

I create my Destination for SQL Native Client to the Database that I plan on importing into. Still good

Next, I select "Copy data from one or more tables or views". I move on to the next screen and select all of the Objects from a Schema. These are Tables that only relate to our application or in other words, nothing Oracle System wise.

When I get to the end it progresses to about 20% and then throws this error about 300 or so times:

Could not connect source component.
Warning 0x80202066: Source - AM_ALERTS [1]: Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used.

So, I'm thinking "Alright, we can search on this error and I'm sure there's an easy fix." I do some checking and indeed find out that there is a property setting called "AlwaysUseDefaultCodePage" in the OLEDB Data Source Properties. Great! I go back and look at the connection in the Import and .... there's nothing with that property!

Back to the drawing board. I Create a new SSIS package and figure out quickly that the AlwaysUseDefaultCodePage is in there. I can transfter information from the Oracle Source Table to the SQL Server 2005 Destination Table, but it appears to be a one to one thing. Programming this, if I get it to work at all, will take me about 150 hours or so.

This make perfect sense if all you are doing is copying a few columns or maybe one or two objects, but I am talking about 600 + objects with upwards of 2 million rows of data in each!!

This generates 2 questions:
1. If the Import Data Wizard cannot handle this operation on the fly, then why can't the AlwaysUseDefaultCodePage property be shown as part of the connection
2. How do I create and SSIS Package that will copy all of the data from Oracle to SQL Server? The source tables have been created and have the same Schema and Object Names as the Source. I don't want to create a Data Flow Task 600 times.

Help!!!

View 8 Replies View Related

Last GASP On Insert Row In Table With Identity Field, And Get New Identity Back ?

Jul 9, 2006

While I have learned a lot from this thread I am still basically confused about the issues involved.

.I wanted to INSERT a record in a parent table, get the Identity back and use it in a child table. Seems simple.

To my knowledge, mine would be the only process running that would update these tables. I was told that there is no guarantee, because the OLEDB provider could write the second destination row before the first, that the proper parent-child relationship would be generated as expected. It was recommended that I create my own variable in memory to hold the Identity value and use that in my SSIS package.

1. A simple example SSIS .dts example illustrating the approach of using a variable for identity would be helpful.

2. Suppose I actually had two processes updating these tables, running at the same time. Then it seems the "variable" method will also have its problems. Is there a final solution other than locking the tables involved prior to updating them or doing something crazy like using a GUID for the primary key!

3. We have done the type of parent-child inserts I originally described from t-sql for years without any apparent problems. (Maybe we were just lucky.) Is the entire issue simply a t-sql one or does SSIS add a layer of complexity beyond t-sql that needs to be addressed?



TIA,



Barkingdog

View 10 Replies View Related

Insert Row In Table With Identity Field, And Get New Identity Back

Jun 30, 2006

I want to insert a new record into a table with an Identity field and return the new Identify field value back to the data stream (for later insertion as a foreign key in another table).

What is the most direct way to do this in SSIS?



TIA,



barkingdog



P.S. Or should I pass the identity value back in a variable and not make it part of the data stream?

View 12 Replies View Related

T-SQL (SS2K8) :: How To Update Identity Column With Identity Value

Jan 25, 2015

I have table of three column first column is an ID column. However at creation of the table i have not set this column to auto increment. Then i have copied 50 rows in another table to this table then set the ID column values to zero.

Now I have changed the ID column to auto increment seed=1 increment=1 but the problem is i couldn't figure out how to update this ID column with zero value set to each row with this auto increment values so the ID column would have values from 1-50. Is there a away to do this?

View 6 Replies View Related

Identity...I Need To Get The Last (or Highest Number In Identity Column)...

Sep 19, 2005

Ok,I just need to know how to get the last record inserted by the highestIDENTITY number. Even if the computer was rebooted and it was twoweeks ago. (Does not have to do with the session).Any help is appreciated.Thanks,Trint

View 2 Replies View Related

Problem In Using Sqlbulkcopy To Insert Data From Datatable(no Identity Column) Into Sql Server Table Having Identity Column

Jun 19, 2008

Hi,
I am having problem in bulk update of a sql server table haning identity column from a datatable( has no identity column) using sqlbulkcopy. I tried several approaches, but it does not show any error nor is the table getting updated. But the identity value seems to getting increased every time.
thanks.
varun

View 6 Replies View Related

How To Use Identity On Non-identity Column (with Concurrence)

Aug 1, 2014

I'm working with a third-party database (SQL Server 2005) and the problem here is the following:

- There are a bunch of ETL processes that needs to insert rows on a table (let's call this table T) and at the same time, an ERP (owner of T) is up and running (reading, updating and inserting on T).

- The PK of T is an Integer.

Today all ETL processes uses (select max(ID) + 1 from T) to insert new rows, so just picture the scenario. It is a mess! Everyday they get duplicate key error when 2 or more concurrent processes are trying to insert a row (with the max) at the same time.

Considering that I can't change the PK, what is the best approach to solve this problem?

To sum up:

* I need to have processes in parallel inserting on T

* I can't change anything on T

* The PK is NOT an Identity

View 4 Replies View Related

Transact SQL :: Alter Non Identity Column To Identity Column

Aug 12, 2009

when i alter non identity column to identity column using this Query alter table testid alter column test int identity(1,1) then i got this error message Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword 'identity'.

View 2 Replies View Related

DTS Wizard...help

Dec 23, 2006

I have downloaded SQL Server Express Service Pack 1, SQL Express Management, SQL Express Toolkit, as well at the DTS Wizard and installed all, looked for Program filesMicrosoft SQL Server90DTSBinn and it isn't tere, did a search on my cjomputer for DTSWizard.exe and cannot find it. Any suggestions? Thanks

View 1 Replies View Related

Dts Wizard

Aug 2, 2000

Here's the scenario: i've got Sql 6.5 server running on our network with about 6 databases.I have ran up another server on the network running sql 7,my
aim is to migrate from the 6.5 server all the databases...etc to the new server running SQL 7, is using the DTS wizard the best way for migration!!I have limited SQL experience and need some advice??I would be most grateful to all you sql gurus out there for any help

Cheers del.

View 1 Replies View Related

DTS Wizard

Apr 11, 2008



hi all,

i have a problem.. i tried installing Microsoft SQL Server 2005 Express Edition Toolkit so that i can have the DTS wizard to import my data. however, i have encountered some problem.

the following components that you chose to install are already installed on the machine. to view a report of available options and alternatives click on details
greyed out - workstation components and development tools 9.2.3042.00

therefore i can't complete the installation. anyone can help me?

thanks.

View 4 Replies View Related

SCD Wizard

Jun 21, 2006

I have created a dimension table for a star schema and included the following columns for treatment of historical changes:


[StartDate] datetime,
[EndDate] datetime,
[Current] varchar(5),
[IsInferred] bit
My Business key is code and the historical attribute is code_desc.

I run the wizard and nominate the Current attribute to be set to True or False. What should the type of this column be as it is not being populated ?

TIA,

Michael Morrissey.

View 1 Replies View Related

Upsizing Wizard

Oct 11, 2007

 I need to upload a very large access database to sql
2005.  Do I break this down by tables, queries or what?  Will
it take a long time.  I believe that database is 3488,888 kb in
size.   Thank youDee 

View 2 Replies View Related

Sql Wizard Error

Apr 4, 2008

Hi there
Apologies if I'm in the wrong post. I have a strange problem. I installed Sql Express Toolkit with the sole purpose to offer the import/export functionality in the Microsoft SQL Server90DTSBinn folder. After installation I did a quick test to make sure it works and it did. Suddenly now I get an error when I run the wizard file saying that it is not a valid win 32 application. I have a clean Windows XP S2 installation and definitly no virussus/worms etc. I have a simmilar problem when I try to run ASP.Net web starter kit files (.vss or something like that...)
PLEASE help me!

View 1 Replies View Related

SqlDataSource Wizard

Apr 23, 2008

Can anyone think of a reason for whilst configuring my SqlDataSource using the wizard in VS2005, when I click Advanced the Generate Insert, Update  and Delete Statements option is greyed out. Been using them plenty of times already elsewhere in the site, yet for no apparent reason it won't work on a couple of pages.

View 3 Replies View Related

DTS Wizard - Buggy?

Aug 11, 2005

Greetings,I have been trying to use the DTS Import Wizard to import data, but SQL Server seems to have a bug that Microsoft has not yet addressed (or have they?)Basically, when I import data from a text file into one of my existing databases that contains a field with an identity, I run into problems. Basically, SQL gives an error and refuses to import my data if the column is set to having an identity. In the Column Mappings, I set that row to "ignore." I also tried checking Enable Identity Insert, and I tried unchecking it. Nothing works. I receive this error message: "...The statement has been terminated. Cannot insert the value NULL into column 'MovieID', table 'myproject.dbo.MovieStars'; column does not allow nulls. INSERT fails."I thought that checking "Enable Identity Insert" would automatically tell DTS to insert an incremental identity value.When I use this transformation code, it doesn't work either:Function Main() DTSDestination("MovieName") = DTSSource("Col001") DTSDestination("MovieStar") = DTSSource("Col002") Main = DTSTransformStat_OKEnd FunctionThis gives me a different but similar error: "Insert error, column 1, ('MovieID', DBTYPE_I4), status 10: Integrity violation; attempt insert NULL data or data which violates constraints. Unspecified error"I think this is a SQL Server bug. My google searches have revealed MANY people with this similar problem, but their problem almost never gets answered. If anyone could please offer assistance, that would be great, as my head is turning black and blue from banging it on my desk for the past 3 days.Thanks

View 3 Replies View Related

Upgrad Wizard

Jun 8, 2001

very simple question but I do not know the answer.
Why I can not find the version upgrad wizard from my program -> sqlserver 7.0 ->?when it is installed ? How can I install this utility?
Thank you very much.

JD

View 1 Replies View Related

SQL 7.0 Upgrade Wizard

Sep 15, 2000

Chaps,

Im trying to upgrade to SQL 7.0 from 6.5. I currently have both installed on the
same machine in a switching enviornment.

I start the upgarde wizard and successfully get to the screen where you
enter the name of the 6.5 import server and 7.0 export server, I click next
and nothing happens (appart from the services stop and restart)!

Any ideas???

View 1 Replies View Related

Upgrade Wizard

Sep 21, 1998

On one of our test server I am trying to upgrade SQL Server 6.5 sp4 to SQL Server 7. The test server has a copy of all the live database systems and user accounts. I am using the Upgrade Wizard.

The process of upgrade stops after the following message

“Verify that code page ‘0’ is installed on your Windows NT Server”

I have no idea as to how I can over this problem. What I do know is that a code page can refer to character set. And that on the server I am upgrading the code page is 850 Multilingual.

Any help please.

View 1 Replies View Related

Import DTS Wizard

May 25, 2006

Hi...

Anybody out there who can help me on how to view the whole import process (DTS package created using Import DTS wizard) in SQL codes? Is there a possibility to view the process using Query Analyzer?

please help.

MyPast

View 1 Replies View Related

Upgrade Wizard

Oct 29, 2001

SQL2000

I'm looking for the upgrade wizard to port from 6.5 to 2000. I must be blind as I cannot find the damn files ...

Any assistance would be appreciated.

Thanks,

Craig

View 2 Replies View Related

DTS Wizard Prob...

Aug 12, 2005

Hi,

Having a problem with DTS Wizard crashing in XP, has anyone experienced similiar problems?

Using XP with SP1, transfering excel file to an oracle serve.

View 2 Replies View Related

Upgrade Wizard

Jul 23, 2005

Hello AllI have SQL Server versions 6.5 and 2000 installed on a Windows 2000server.I installed 6.5 first, coppied a backup of a database to the server andrestored it. I then installed 2000. I am trying to use the upgradewizzard.On the first screen I keep the default settings, export and importobjectsand data, use a named pipe. Its all on the same server, give it the sapassword for both installations (its the same). All services arerunningunder local system account.It switches between the two versions a couple of times then comes upwiththis error message:Couldn't create or register the SQLUpgrade DSNAnybody got any idea what it means?RegardsMatt

View 2 Replies View Related

Maintenance Wizard

Jul 20, 2005

I'm trying to backup several databases to UNC folders. I'm able to do itmanually for each database, but when I set up the maintenance plan it failsbecause SQL tries to use the SQL administrator account to push the data.The million dollar question is how does one change which account is runningthe maintenance?

View 2 Replies View Related

Implementation Of SCD Without Using A Wizard

May 24, 2007

Hi,



Please someone tell me the procedure of implementing the Slowly changing Dimension without using a wizard.



Thanks,

Chandana.

View 5 Replies View Related

Msi Did Not Install ADS Wizard

May 10, 2007

I ran the msi file but thereis no ADS wizard on my programs list, even after a reboot. When I run it again it does a repair but there is still no program. How do I find the right cab file for my device (DellAxim X51 With WM2005)

Is there a way to identify the wizard in C:programs?

View 1 Replies View Related

Web Sync Wizard On XP Box

Jan 14, 2007

I have (finally) successfully gotten through the maze and 'published' my database to a folder:

Physical path: I:SqlReplication

unc: WarrenassocSQLReplication

Since I'm running XP pro, I don't have the options of assigning specific read/write permissions to a folder.

However it appears the problem is with accessing the snapshot and the logon's there.



When I run the IIS Web Configure wizard I error out at the snapshot share permissions step (see report below)

Wizard Settings:

Click Finish to perform the following actions:


Modify a virtual directory immediately.

Copy the ISAPI dll 'sqlcesa30.dll" to 'I:SqlReplication" immediately.

Set NTFS permissions immediately.

The virtual directory 'SqlReplication' will be configured with the following options:


On server 'WARRENASSOC'.

Use 'SqlReplication' as the alias.

Use 'I:SqlReplication' as the physical path for the virtual directory.

Use 'Anonymous' as the authentication method(s).

Do not require secure channel.

Set user permissions to 'Execute'.

Clients can use 'http://WARRENASSOC/SqlReplication/sqlcesa30.dll' as the Internet URL.

'sqlcesa30.dll' will be copied from 'C:Program FilesMicrosoft SQL Server 2005 Mobile Editionserver' to 'I:SqlReplication'.



'WARRENASSOCEd Warren' will get the following NTFS permission:


'Read & Write' on physical path 'I:SqlReplication'.

'Read & Execute' on the ISAPI DLL 'I:SqlReplicationsqlcesa30.dll'.

'Read' on share physical path '\WarrenassocI$SqlReplication'.

'Read' on the share '\WarrenassocI$SqlReplication'.





- Modifying the virtual directory (Rolled back)

- Copying the ISAPI DLL (Rolled back)

- Setting the directory permissions (Rolled back)

- Setting the server agent permissions (Rolled back)

- Setting the snapshot directory permissions (Rolled back)

- Setting the snapshot share permissions (Error)



Messages

The operation completed successfully. (Exception from HRESULT: 0x80070000) (mscorlib)


- Modifying the Virtual Directory configuration file. (Stopped)







When I created the snapshot I used my personal logon (admin rights) at each step

I've tried all combinations of setting the permissions in the wizard from requiring a login and providing my personal login to no requirements and I get the same error.



I'm trying to set up to copy a database from my SQL Server 2005 --> SQl Server CE 31 RC1

to see it it meet my development needs.

I'm at a loss as to how to navigate the security maze!!

Thanks Edward Warren.









View 8 Replies View Related

Import Wizard

Jun 22, 2006

Hi,

I'm trying to import data from Microsoft Access. I already have all the
tables in SQL Server and also the relationships, but I can't seem to
import any data without deleting the relationships. Is there a way to
do this without deleting them?

View 3 Replies View Related

Upsizing Wizard

Jan 20, 2006

A few days ago I installed SQL Server 2005 Express edition and successfully used the upsizing wizard to convert a MS Access database to SQL Server database. Today I found I could get VB.Studio Express. The instructions said to delete SQL Server Express and .NET before installing VB Studio because it would re-install them both. I faithfully did that but since then I have been unable to get the upsizing wizard to work again. I have uninstalled SQL Server and re-installed it but still cant get it working. From SQL Server Configuration manager I can confirm that Shared Memory and TCP/IP protocol are both enabled for both protocols for clent and protocols for SQLEXPRESS Both the SQL Server and the SQL Browser are running. And from SQL Server Surface Configuration I can confirm that OPENROWSET AND OPENDATASOURCE SUPPORT is disabled; CLR Registration is disabled; OLE AUTOMATION is enabled; and xpCommandshell is disabled.

When I run the upsizing module it goes through the motions but the report at the end says "table was skipped or export failed" for each of the tables in the database.

I have looked everywhere I can think of to try to find a solution but no one so far has been able to help.

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved