Is it possible to insert into two tables at the same time?

In one statement: No. In one transaction: Yes BEGIN TRANSACTION DECLARE @DataID int; INSERT INTO DataTable (Column1 …) VALUES (….); SELECT @DataID = scope_identity(); INSERT INTO LinkTable VALUES (@ObjectID, @DataID); COMMIT The good news is that the above code is also guaranteed to be atomic, and can be sent to the server from a client … Read more

In Perl, how do I change, delete, or insert a line in a file, or append to the beginning of a file?

(This is the official perlfaq answer, minus any subsequent edits) The basic idea of inserting, changing, or deleting a line from a text file involves reading and printing the file to the point you want to make the change, making the change, then reading and printing the rest of the file. Perl doesn’t provide random … Read more

Django: Insert row into database

If you only want to quick test your models you can start an interactive shell and execute your code there. python manage.py shell The above command starts a python interactive shell initialized with your Django project settings. Then you can do something like: from your_app_name.models import Dodavatel p = Dodavatel(nazov=’Petr’, dostupnost=1) p.save() I do not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)