Get catalog folder in Oracle
SELECT * FROM V$DIAG_INFO
Get catalog folder in Oracle
SELECT * FROM V$DIAG_INFO
Example of creation the SEQUENCE in MSSQL:
CREATE SEQUENCE [dbo].[CardNum]
AS [bigint]
START WITH 1
INCREMENT BY 1
MINVALUE -9223372036854775808
MAXVALUE 9223372036854775807
CACHE
GO
That script will create the sequence named CardNum that have type BIGINT and begin from value 1 in current database.
For turning on xp_cmdshell just do:
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
Restart MSSQL Server on Linux (Ubuntu).
Microsoft is recommend do that like this:
-- Get service state
sudo systemctl status mssql-server
-- Stop service
sudo systemctl stop mssql-server
-- Start service
sudo systemctl start mssql-server
-- Restart service
sudo systemctl restart mssql-server
To get current SESSION ID:
select @@spid
To get current TRANSACTION ID:
select CURRENT_TRANSACTION_ID()
An exemple UPDATE WITH JOIN in MSSQL
update cc
set cc.ActivateState=2
from ClientsCards cc
left join ClientsCardsHeads cch
on cch.CardUid=cc.Uid
where cc.ActivateState=0 and cch.State=3
An "OFFSET FETCH" is a filter, that allows to miss some number of first rows.
For example:
select field1, field2, field3
from table1
order by field1, field2
offset 100 rows fetch next 50 rows only;
That example return the rows from 101 to 150, from all rows that ordered by field1 and field2.
Two options for executing transaction in MSSQL, each rollback by error.
First option:
BEGIN TRY
BEGIN TRAN
UPDATE 1
UPDATE 2 --Error
UPDATE 3
COMMIT TRAN
END TRY
BEGIN CATCH
ROLLBACK TRAN
END CATCH
An example searching of procedure by text it contain
SELECT name
FROM sys.procedures
WHERE Object_definition(object_id) LIKE '%some_text%'
It's return all procedures each contains "some_text"