I have created Oracle Database on windows machine , with test table.
CREATE TABLE TESTUSER ( NAME VARCHAR2(20) , LASTNAME VARCHAR2(20) );
and inserted data into this table
insert into testuser(name, lastname) VALUES('Jon','Doe');
Then remote connected to this database from another machine, connected and authenticated successfully, I can see table and columns, but when I query the table, it is empty.
Have anyone faced similar issue? will much appreciate the hint or correct direction.
Related
We start with the facts:
Logins are in the master database,
users are in a user database.
Azure does not allow to change database with USE statement.
SQL requires the user to be in the master database in order to execute ALTER LOGIN statement.
.
--USE master;
--**ERROR** USE statement is not supported to switch between databases. Use a new connection to connect to a different database.
--GO
ALTER LOGIN nonadmin WITH PASSWORD='new5as$word' OLD_PASSWORD='old5a$sword';
--**ERROR** User must be in the master database.
GO
It is possible to migrate the database to contained mode, but this way would be quite exhausting as the legacy code have plenty of places like this:
IF(OBJECT_ID('tempdb..#temp1') IS NOT NULL)
BEGIN
DROP TABLE #temp1
END;
CREATE TABLE #temp1
(
id int not null IDENTITY,
CONSTRAINT PK_tt1 PRIMARY KEY(id)
)
Is there a suitable workaround except migrating to contained database mode?
You are trying to change the password of a contained user. Contained users don't have server logins so you can't use the ALTER LOGIN statement.
You need to use ALTER USER :
ALTER USER nonadmin WITH PASSWORD='new5as$word' OLD_PASSWORD='old5a$sword';
A server login is the identity with which you login to a server. In SSMS, you'll find logins in a server's Security node. These logins are then granted access to specific databases as users. These users are stored in the master database.
elect the Database choice on the left, then select Servers:
Then, after selecting the server of choice, you'll see the option on the right for resetting admin password:
source : Password reset for Azure database
I am trying to create a table in SQL Server
create table admin (name varchar(40), pass varchar(40))
The problem is I don't want password to be visible I mean it should be shown like **** as usual in log in systems.
Waiting to hear from you soon.
I got a task from my customer on his existing SQL Server database.
They have a database with 1 user with all admin rights. They manage the accessibility rights on the application level.
The task is to create an audit table, to audit who INSERT, UPDATE, & DELETE from database tables.
The structure of this table is simple:
TableName
Operation {INSERT, UPDATE, or DELETE}
TimeStamp,
UserName
The audit log is requested to be on server side through triggers.
So it is an EASY Task: Add Trigger to each table & each Event. Inside the trigger, insert a new row to Audit Table with Values of (TableName, Operation, TimeStamp, & UserName).
The problem is the username (SQL: SYSTEM_USER) is always the same for all users as they all connect with the same admin account.
Is there anyway, in SQL server, to get the network user name who is making the transaction?
I am sorry I should have made some researches before asking. Anyway, it could be useful to others.
I found this function [Host_Name()], which returns the name of the computer that makes the transaction.
It's a MS Access app with linked tables to SQL Server. I need to log this on the SQL Server as I cannot modify the MS Access app.
The app connects to the SQL Server through a default SQL username.
You will need a trigger for this, and a table to store the results. Very quick prototype:
CREATE TRIGGER dbo.trigger_name
ON dbo.table_name
FOR DELETE
AS
INSERT INTO dbo.LogTable(RowID, UserName)
SELECT PK_Column, SUSER_SNAME()
FROM deleted;
GO
Note that unless each Access user authenticates to SQL Server as themselves, you may need to use host name or some other property to identify them (if they all connect as the same SQL user, there is little SQL Server can do to determine who they really are).
All existing tables are with prefix dbo.TableNames
When I create a new table, it creates as login.MyTable instead of dbo.MyTable.
The screenshot is Security > Properties of my login.
Could you please show me step by step (I am not familiar with SQL securites) how to solve this problem?
Thanks in advance!
That means your default schema is your username (assuming that you mean login is actually a username like win and not really login). If you're using the UI table designers it will select that schema for you. You can try using:
CREATE TABLE dbo.TableName (
-- some columns
);
But you may not have access to the dbo schema.