You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.
SELECT HOST_NAME() AS Hostname;
-- prints myComputer1 or srvWindows1
227
PowerShell
Systeminfo
Hostnamen ermitteln
$myHostname = [system.environment]::MachineName;
write-host $myHostname;
# prints MyComputer1 or srvWindows2
220
T-SQL
Strings
Position eines Teilstrings finden
DECLARE @searchFor_Charindex Varchar(10)
DECLARE @searchFor_Patindex Varchar(10)
DECLARE @text Varchar(100)
SET @searchFor_Charindex = 'simple'
SET @searchFor_Patindex = '%simple%' -- Remember the %. Patindex can also be used for RegEx!
SET @text = 'this is a simple text'
SELECT CHARINDEX(@searchFor_Charindex, @text) AS Position_Charindex
SELECT PATINDEX(@searchFor_Patindex, @text) AS Position_Patindex
-- 11
221
Delphi
Strings
Position eines Teilstrings finden
searchFor:='simple';
text:='this is a simple text';
ShowMessage(IntToStr(pos(searchFor,text)));
// 11
217
T-SQL
Datenmengen
Anzahl Zeilen Resultset begrenzen
SELECT TOP 100 * FROM tableA
218
MySQL
Datenmengen
Anzahl Zeilen Resultset begrenzen
SELECT * FROM tableA LIMIT 100;
219
ORACLE PL/SQL
Datenmengen
Anzahl Zeilen Resultset begrenzen
SELECT * FROM
(
SELECT * FROM tableA
)
WHERE ROWNUM <= 100
209
SQLite
Datum, Zeit
Kalenderwoche eines Datums
-- Standard Weeknumber function from SQLite:
-- http://www.sqlite.org/lang_datefunc.html
SELECT strftime('%W', '2014-08-25')
-- The above calculation can lead to an wrong number if you expect an iso calendar week.
-- Therefore better:
-- http://stackoverflow.com/questions/15082584/sqlite-return-wrong-week-number-for-2013
SELECT
(strftime('%j', date('2014-08-25', '-3 days', 'weekday 4')) - 1) / 7 + 1 AS ISOCalendarWeekNumber;
210
T-SQL
Datum, Zeit
Kalenderwoche eines Datums
select DATEPART(ISO_WEEK,CAST('2014-08-25' AS DATE))
207
T-SQL
Datenbank
Manuell einen AutoIncrement/Identity/Serial Wert in Tabelle einfügen
SET IDENTITY_INSERT myTable ON
INSERT INTO myTable(Identity_ID, Value) VALUES (4711, 'Back To The Future...')
SET IDENTITY_INSERT myTable OFF