@deostroll Sounds like something can't understand Unicode. There are a few people who answer MongoDB questions on the site, but no one in chat that I'm aware of.
If the framework qualifies as a DB tool, I guess it would be on-topic here, but then the question may need some additional tags, I'm not sure what they should be.
I mean, just adding php wouldn't make much sense, as PHP itself is not a DB tool.
@AndriyM parent table has an autonumber PK that i would ideally want to directly relate to the PK in the second table. the insert statement is within a script. the first part goes as follows (the values are from a data elsewhere in the script): INSERT INTO Products (ProductNumber, ProductName, InternalID, IdentifiedUses) VALUES (?, ?, ?, ?). when it does the same thing for the second table, then it errors, presumably because it's clashing with that one to one PK.
i can do it manually in access no problem but i want to do it in code so it can be fully scripted.
Presumably there should be some built-in function in Access that returns the last generated autonumber value. You probably want to use that function together with the values inserted into the second table.
essentially, it's just a microsoft sql database. i don't need access open to run the script. but i'll have a look around to see if i can find something like that.
actually sorry it is running "Microsoft Access Driver" so you're right
The second INSERT might look like this: INSERT INTO ProductHaz (ProductFK, SignalWord, PhysicalHazards, Contains) VALUES (LAST_AUTONUMBER(), ?, ?, ?)You'd only need to get the names right (the FK column and the function)
I have a JET table with an auto-number as the primary key, and I would like to know how I can retrieve this number after inserting a row. I have thought of using MAX() to retrieve the row with the highest value, but am not sure how reliable this would be. Some sample code:
Dim query As String
...
Now that I better understand that you are trying to extract data, here is a new answer. This just simply extracts data from a table that I created in tempdb.
use tempdb
-- drop table mytable
create table mytable
(id int, customer_name varchar(55), cityname varchar(55), statename varchar(55))...
@ypercube Before my second comment, there was a comment by the answer's author where they claimed they posted their solution before Craig edited in the same into his answer.
@CraigEfrein The answerer did remove at least one of their comments. It was their response to both of us where they said you added the quotename solution after their answer. Possibly they removed it before you had time to read it.
Don't think they were trying to deceive anyone, though. Probably they just made a mistake. I'm removing my responses as well.
SQL Server 2005
I ran "dbcc SQLPerf(logspace)", then took two log backups, and ran "dbcc SQLPerf(logspace)" again. No change from 48.55% used, even though "dbcc opentran (foo)" says that there are no active open transactions.
Does that mean that there are inactive open transactions that are pr...
@MarkStorey-Smith, @MarkSinkinson, @MartinSmith, @JamesLupolt, @JackDouglas, @ypercube - do we want to move from Fri 28 to avoid the Underground strikes? We could do Thurs 20 (this Thurs) and @MarkStorey-Smith can make it. Otherwise, to the following week?
pyodbc.IntegrityError: ('23000', "[23000] [Microsoft][ODBC Microsoft Access Driv er] You cannot add or change a record because a related record is required in ta ble 'Product'. (-1613) (SQLExecDirectW)")
If I take out the last line, it works fine... If I replace the third line of SQL there with the 4th, it also works! As soon as I have both lines there, it gets stuck.
@marcusdoesstuff Does [Product Hazards] have its own autonumber column? Does [ProductHPhrases] have its own autonumber column?
The @@IDENTITY function returns the last inserted autonumber value. If you inserted a row into a different table, the new @@IDENTITY result will pertain to that table.
So, if you want to re-use a particular @@IDENTITY value, especially if you want to re-use it in various INSERT statements, you need to read it separately, then pass as another input value
It worked because you were using each @@identity value once. In your 4th statement, you used @@IDENTITY and you wanted the identity from the 2nd statement but it used the last one (from the 3rd statement)
My team's using a python-based wiki server that calls stored procedures on a SQL Server database. Ideally, we'd like to return integer values (1,0,-1) from the stored procedure to show basic results.
According to a 2008 thread on Google Groups, return values aren't supported by pyodbc, so the al...
@ypercube Wasn't sure the syntax. Since the linked question indicated it was how to get the return value, I didn't want to deviate. The other articles indicated I would need to use a cursor to get rows back
I never used pyodbc in my python days, since I was always in a MS environment, I used the ado drivers
:setvar ServerName "PASQL44I2HELLO"
:setvar DatabaseName "WORLD"
:setvar OrderIdsSeparatedByCommas "000000"
if not exists ( select * from [$(ServerName)].[$(DatabaseName)].[dbo].[vendor_client_orders] where vco_oid in ($(OrderIdsSeparatedByCommas)) )
begin
select 'Order(s) [ $(OrderIdsSeparatedByCommas) ] not been sent / null.'
end
else select -- etc ...
@billinkc I bruise really easily. That photo was a combo of the rafters, leaning on a ladder all weekend, plaster and debris hitting my legs during demo. It doesn't take much for me to bruise. The people at my gym tell me "I'm a peach"
I've set up a small fail over cluster using AlwaysOn in SQL2014 and Windows 2012R2.
The cluster (SQL-CLUSTER-DEMO) just contains 2 SQL nodes (SQL-01 [Primary] & SQL-02 [Secondary]) and a file share quorum. Availability Group is set up in SQL server no problems.
I am connecting to SQL-CLUSTER-DE...
It would be nice except. Interacting with it is a nightmare. The list performance goes to hell if it has any amount of data in it. You either need to set up a database sync to have a reliable connection or use the impossibly wonky SharePoint list adapter.
@billinkc sharepoint is the victim of being a good, but halfassed implementation, upon which other vendors bolted cool things prompting a microsoft purchase and halfassed integration. it's a frankenstein.
I've said in several meetings that choosing SharePoint as a datasource would be the equivelant of shooting our project in the face. Yet every time it looks like the easiest solution on paper.
Gee we can set it up so easy and the ETL doesn't take long. Oh wait now we made 1 change and our entire project is broken. Oh no now the list is too big so it won't load. We'll have to archive that data off and build reporting for that too.
Goly building a nimble web app would have been so much easier.
Yes, i try the query that you suggested before posting the question. It is working when using ' ' in col1. But it is very strange, how this query is working "SELECT b.col1,b.col2 FROM table b WHERE b.col1=123 AND b.col2 like '%59%'" with out using ' ' — Venkata Seera4 mins ago
I have varchar columns in my db where the value is not english ( but hebrew). But How is that happend at first place ? What enabled this to save hebrew letters in a varchar column ?
(Where can I find the setting in SQL server that allowed it ?)
-
-
Foudn it it's the collation. I thought that collation only set the rules for ordering/comparing
but it seems that it also determines the code page. Thanks.
Paul - can you please shed light ? does the collation of SQL SERVER is set when installing ( auto looking at regional settings) , or is it by a human set when installing ?
@PaulWhite To me it's definitely a better fit for SO in the current form. I don't think questions about frameworks like Linq-to-SQL or the one in that question should be asked here but I realise that they can be considered DB tools and therefore formally acceptable, according to our rules.
@RoyiNamir I believe I misunderstood you when you asked that question earlier. Server collation is definitely an option at the time of installation. I mistakenly thought you were asking about how the SQL Server Setup program determines the default value (which you can then change), rather than how a SQL Server instance gets its collation – the latter, as I said, is configurable during setup, the former I don't know.