Sylius create taxon - The server returned a "500 Internal Server Error" - sylius

When I go to the admin panel of Sirius and create category(taxon), and then delete it, and then re-create with the same name I get an error - The server returned a "500 Internal Server Error".
You can try on http://demo.sylius.org/, the same situation on local site.
Can somebody help? thanks.

When you delete a taxon it's not deleted in database.
There is an column deleted_at which is null by default and if a taxon is deleted this field has a date.
If you want to undelete your taxon you must set this field to null.

Related

How do i add a User to a Database that is in an always on Availability group?

i have a an always on availability group with one database called Mydb, 1 Primary Replica - MyReplica1 and 1 secondary - MyReplica2 in Async Commit. It is also a readable secondary.
I want to add a new login and map it as DBO in the database Mydb.
Creating the login and mapping in MyReplica1 is fine with no issues.
Creating Login on MyReplica2 is fine but i cannot map it or create the user as i get the error below
Failed to update database "Mydb" because the database is read only. (Microsoft SQL Server, Error: 3906)
Any thoughts on how i can go about this without having to failover to the Secondary just to create the Login.

Azure SQL MI: The requested server principal already exists on Managed Instance

In my SQL MI i have a ad group (called Group A) which was already assigned to the Active Directory Admin through Portal. I'm trying to update/replace that with a new group called Group B.
When I tried I get the error like
{"error":{"code":"ServerPrincipalAlreadyExists","message":"The
requested server principal already exists on Managed Instance.
Consider dropping the server principal and retrying operation."}}.
When I tried to add another new group called Group C it works. But the issue with Group B still exist
Questions:
How come the new group B has been already exists on the MI ?
How to remove the service principal ?
P.S I tried by removing the existing group from the active directory admin and add the new group B still the same issue
You need to check whether group B exists among service_principals and drop it. You can check that by looking at server_principals table https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-server-principals-transact-sql?view=sql-server-ver15. If it exist you need to drop sp(probably you added it as a login and thus it is server principal).

Getting the logged in user name inside a stored procedure on a linked server

The standard in our company is to log the user name that inserts or updates a record at the time the record is inserted or updated. We inset and update the tables calling stored procedures from applications. We use SUSER_SNAME() in the stored procedures to get the name. Now we've added inserting records in a table on a linked server. The SUSER_SNAME function not is returning the same login name as it does on the native database. Instead it is returning the name of the account created to link with. I know I can pass the user name as another parameter to the query, but it would be easier if there is a built-in function that works both when connected to the server directly, and when connecting to a linked server. Is there a built-in function that does this?
Stored procedure
INSERT INTO Account (ForeignKey, AccountNumber, IsProcessed,
Origin, Updated, LoginName, Total)
VALUES (#ForeignKey, #AccountNumber, #IsProcessed,
GETDATE(), NULL, SUSER_SNAME(), #Total)
RETURN SCOPE_IDENTITY()
No, there's no function to do this. When you create a linked server, the linked server "opens a connection" to the 2nd server. You, the user, have a connection to the 1st server. So when you run suser_sname() on the 1st server, you get your username that you are connected with. When you run it on the 2nd server, you STILL get the user name that you are using to connect to the second server. The difference is that the connection to the 2nd server is controlled by the administrator that configured the Linked Server. In your case, it sounds like he created a special account that is used for a linked server connection. Another option is to map accounts from the current server to accounts on the 2nd server. (If your DBA had done that, you might be getting the results that you want right now and not had any issues.) There are different ways to configure a linked server, and security should generally be a priority when doing so.
So, if you want to execute a query on the 2nd server and use your user name from the 1st server, then you need to pass it to the 2nd server, because it has no way of knowing who you are on a different machine.

how to delete an entry from azure sql?

here is screenshot from my azure sql database. I would like to remove user Nazerke. I've deleted the row, and when I wanted to save it, it gives me " Incorrect syntax near WHERE" as you can see on the top of database. How can I delete the user and what could be possible solution?
It looks like the password contains weird characters, maybe the Silverlight application has issues supporting these (don't know for sure). Could you try to delete an other record, like the user with username JDuck?
Update: The actual solution can be found in this question: how to change permission for the service account in azure's sql management portal
This is just a user defined table that you created? Just delete the row: delete from [dbo].[Users] where Guid = '<guid>'

SQL server : Login issue while querying

I have a web application running with a SQL server 2005 DB as back end.I took the db back of the production site and restored in my development machine.Then i tried to query this database using the login "sa".When trying to execute the "select * from Customers" query, i am getting a message like "Invalid object name 'Customers"
But when i run "SELECT * FROM [352974_mg4l1].[Customers]", It is returning records.
352974_mg4l1 is a user for this database present when i restored the db backup from production.
What i have to do for getting the records using with simple select query which i used initially("select * from Customers" ). I know it is something related to login issue.Can any one tell me how to solve this ?
The Customers database object is not owned by the dbo schema.
And by referencing Customers as 'sa' you are looking for [dbo].[Customers] ?
I would suggest to:
either provide the object's full name
either change it's schema
Edit:
To alter the schema of said table try this:
ALTER SCHEMA dbo TRANSFER [352974_mg4l1].Customers;
Reference: http://msdn.microsoft.com/en-us/library/ms173423.aspx
Look up sp_changeobjectowner in Books on line. That will help you change the owner. The real question is how the object got created to a specific owner to begin with. If this is true on prod, you could have some major issues with other people accesssing the database.