there is no speculation necessary with my method, which ~always~ works correctly
boy, are you ~ever~ having a hard time accepting the superiority of my solution
there is no speculation necessary with my method, which ~always~ works correctly
boy, are you ~ever~ having a hard time accepting the superiority of my solution
I didn’t say your solution would not work.
but let’s take a hypothetical case (which could also be the OP’s but I’ll never know with 100% certainty) where
you have 2 identical tables with say 50+ columns each
the insert table will always be empty prior to an insert
in this case it will be much easier and quicker for me to use * to select all the columns than type, copy and paste or whatever 49 or however many column names I need to be copied.
hypothetical cases are mere speculation
if you’d like to discuss your scenario, you are free to start a new thread, i will be sure to reply
At last we agree on something :sparty: :Partydude:
Due to the lack of detail from the OP, you were speculating the OP’s table might not always be empty - in which case your query could have a lot more characters in it than mine - and I was speculating that it was always empty prior to inserts - in which case my query is short and sweet.
so it boils down to
Posted by Moi
the op didn’t specify if the table had previous rows in it or not.
if the table is always going to be empty (as it is in a lot of my use cases) just before the insert then what I posted is totally valid.
if the table is not empty before the insert then the auto increment should not be copied over
that’s crap
i did not speculate – i gave a solution which always works
you, on the other hand, jumped part way into the thread without actually stopping to think (and this isn’t the first time you’ve done that), and you have needlessy extended this thread with elaborate back-pedalling, justifying your “solution” by speculating…
to recap: i did not speculate, and my solution always works
give it a rest, now, okay?
I never said it wouldn’t work.
But if the OP’s situation is as I think it could be (and I’ll never know for sure if it is or isn’t) I will always recommend the query I posted originally which is much shorter than what you suggested but it would also work.
btw - if you’re going to quote me, please quote the whole sentence and not just bits and pieces out of context to suit any agenda you might be pushing.
what I said in total was
Due to the lack of detail from the OP, you were speculating the OP’s table might not always be empty - in which case your query could have a lot more characters in it than mine - and I was speculating that it was always empty prior to inserts - in which case my query is short and sweet.
okay, i will quote you in context
Due to the lack of detail from the OP, you were speculating the OP’s table might not always be empty - in which case your query could have a lot more characters in it than mine - and I was speculating that it was always empty prior to inserts - in which case my query is short and sweet.
see that part in red there? especially the bolded part? that’s crap
go ahead and recommend your only-works-under-certain-conditions solution
i will continue to recommend a solution that always works
that’s ok
we can then just agree to disagree.
i don’t know why you would want to disagree with a solution that always works, but if that’s what you want to do, knock yourself out
I’m not disagreeing with your solution. I was saying that my query is much shorter than what you suggested if the OP’s situation is that the insert table is always empty prior to inserts.
What I am disagreeing with you on is whether you were speculating on whether the table was empty or not.
In my opnion you were speculating that the table might not always be empty just as I was spculating it will be always empty.
If the table is always empty I will always use my shorter query over your longer solution which will also work.
I
you are entitled to your opinion that i was speculating, but you are flat out wrong, and it verges on insulting
please, give it a rest, okay?
that’s ok
we can then just agree to disagree.
nope, not me
that’s ok
sweet dreams :angel3:
To wake things up again, if you don’t want to copy over the auto-increment values, then you copy over all the fields that are not auto-increment ones.
Trying to take shortcuts such as using SELECT * may work on some occasions, but It’s better to know how to ensure that it works in all cases.
yep agree and in the case where there will sometimes be existing rows I would obviously not copy the auto increment.
but in the case where the table must always be empty first then I would either drop the table and rerun the creation script or just delete the existing rows and then use * to select the columns to be inserted. but if anyone else prefers to list all the columns, that’s fine as well.
using the * results in one less line of code for me to edit should the table columns need to be changed in the future for whatever reason.
so for me, it means first establishing the purpose and requirements of the task and then coding to suit.
Back to the original problem, I see no one has mentioned RENAME TABLE:
Possibly because renaming the table will retain the auto-increment id’s, whereas the OP specifically requests that they not be retained, but instead be recreated from fresh in the target table.