Click here to Skip to main content
14,579,459 members

Comments by Daniel Miller (Top 7 by date)

Daniel Miller 12-Dec-15 15:15pm View
   
Reason for my vote of 5 \n This is a very thorough list of useful tools - thanks!
Daniel Miller 21-Oct-15 10:05am View
   
To confirm then, you are no longer getting an error, and the tables in SQL Server are successfully created and loaded from Access, but the primary key column in the new tables does not have the Identity property enabled - is that correct?

If so, then this is a resource you might want to check:
http://blog.sqlauthority.com/2009/05/03/sql-server-add-or-remove-identity-property-on-column/
Daniel Miller 20-Oct-15 10:33am View
   
You don't need to create the destination tables, and you don't need to worry about setting IDENTITY_INSERT in your stored procedure.

"SELECT * INTO" will create the table and correctly load your data from the source tables.

I don't know what error you are getting, but I think you should remove "SET IDENTITY_INSERT '+@table1+' ON;" from the code in your stored procedure because that is the most likely source for an error.
Daniel Miller 19-Oct-15 13:21pm View
   
Thanks, I appreciate it. I have been 'lurking' on the CodeProject site for years because it's such a great resource, and recently I decided I ought to begin contributing something back to it, so I am working to develop and improve a reputation in the community here.
Daniel Miller 19-Oct-15 12:42pm View
   
Fair enough - point taken.
Daniel Miller 19-Oct-15 12:28pm View
   
Well, yes, obviously you would use a parameterized query in a live system. How to do this was not the question being asked, and my solution was intended to illustrate a specific answer to a specific question as simply as possible. Rather than criticize, perhaps you could have posted a helpful amendment like this:

var select = "SELECT HASHBYTES('MD5', ChunkData) FROM dbo.x where Id = @ID";
var parameter = new SqlParameter("ID", 40);
var query = context.Database.SqlQuery<byte[]>(select, parameter);
var buffer = query.FirstOrDefault();
Daniel Miller 18-Oct-15 19:27pm View
   
Sorry my answer was not more helpful. Your question was tagged "SQL" so I thought you were looking for SQL code.

What programming language are you using?

Where are your identifier values stored? In a database or a text file?

How does your code know what identifier values have been generated previously, so that you don't generate any duplicate values?