Bosna i Hercegovina


switch Lista naslova:

#1 26.08.2018-11:20
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,541


Subject: Ms Sql Arhiva*
U OVOJ TEMI STAVLJAMO MSSQL FUNKCIJE ,STOR PROCEDURE , TRIGERE , SQL Pitajna i sve ostale stvari koje ce nam biti korisne.
Ovaj komentar je mijenjan 1 puta. zadnja izmjena 26.08.2018-19:52 od strane zxz. ↑  ↓

#2 26.08.2018-11:22
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,541


Subject: Redni Broj
Kako dodati redni broj u query koe pravimo

SELECT ROW_NUMBER() OVER(ORDER BY ID_Korisnik ) AS Row,tblKorisnik.* From tblKorisnik
Ovaj komentar je mijenjan 1 puta. zadnja izmjena 26.08.2018-11:23 od strane Gjoreski. ↑  ↓

#3 27.08.2018-19:58
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,541


Subject: Reset ID na neku tabelu
Cesto vam zatreba da se ID pole postavi na 0 ili ne neka druga vrednost

DBCC CHECKIDENT ('tblArtikli', RESEED, 0)

Budite oprezni kad koristite funkiju , nakon koristejne ove funkcije nekad ID pole zna da se cudno ponasa.
↑  ↓

#4 27.08.2018-20:06
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,541


Subject: Link MS ACCESS baza na MSSQL SERVER
Cesto vam zatreba da se uporede ili prebace podatke izmedzu MSSQL databaza i MS ACCESS databaza.
Ova e eden od mnogute nacini kako mozete spoiti ove dve vrste baze.

DownloadIzvorni kod (SQL):
  1. exec sp_addlinkedserver @server='Access',
  2. @srvproduct='Access',
  3. @provider='Microsoft.Jet.OLEDB.4.0',
  4. @datasrc='D:\PROGRAMIRAJNE\TAXI MK\TAXI TDB 8X\BazaT.mdb'
  5.  
  6. -- Ovako se poziva
  7.  
  8. SELECT * FROM OPENQUERY(Access , 'select * from tblArtikli')
↑  ↓

#5 10.11.2018-16:33
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,541


Subject: SELECT FROM Stored Procedure
Jedan nacin kako pozvati Stored Procedura , a rezultati koristite za ponatamosna obrada

DownloadIzvorni kod (SQL):
  1. CREATE TABLE #GetVersionValues
  2. (
  3.     [INDEX] int,
  4.     [Name]  sysname,
  5.     Internal_value  int,
  6.     Character_Value sysname
  7. )
  8. INSERT #GetVersionValues EXEC master.dbo.xp_msver 'WindowsVersion'
  9. SELECT * FROM #GetVersionValues
  10. DROP TABLE #GetVersionValues     -- Ovo je linija gde se obraduje podatke
↑  ↓

#6 09.12.2018-22:15
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,818


Subject: Formati datuma
Formati datuma na MsSQL.
Format datumastnadardSQLizgled
Mon DD YYYY 1DefaultSELECT CONVERT(VARCHAR(20), GETDATE(), 100)Jan 1 2005 1:29PM 1
MM/DD/YYUSASELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]11/23/98
MM/DD/YYYYUSASELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]11/23/1998
YY.MM.DDANSISELECT CONVERT(VARCHAR(8), GETDATE(), 2) AS [YY.MM.DD]72.01.01
YYYY.MM.DDANSISELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD]1972.01.01
DD/MM/YYBritish/FrenchSELECT CONVERT(VARCHAR(8), GETDATE(), 3) AS [DD/MM/YY]26348
DD/MM/YYYYBritish/FrenchSELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY]26348
DD.MM.YYGermanSELECT CONVERT(VARCHAR(8), GETDATE(), 4) AS [DD.MM.YY]25.12.05
DD.MM.YYYYGermanSELECT CONVERT(VARCHAR(10), GETDATE(), 104) AS [DD.MM.YYYY]25.12.2005
DD-MM-YYItalianSELECT CONVERT(VARCHAR(8), GETDATE(), 5) AS [DD-MM-YY]35819
DD-MM-YYYYItalianSELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY]35819
DD Mon YY 1-SELECT CONVERT(VARCHAR(9), GETDATE(), 6) AS [DD MON YY]04 Jul 06 1
DD Mon YYYY 1-SELECT CONVERT(VARCHAR(11), GETDATE(), 106) AS [DD MON YYYY]04 Jul 2006 1
Mon DD, YY 1-SELECT CONVERT(VARCHAR(10), GETDATE(), 7) AS [Mon DD, YY]Jan 24, 98 1
Mon DD, YYYY 1-SELECT CONVERT(VARCHAR(12), GETDATE(), 107) AS [Mon DD, YYYY]Jan 24, 1998 1
HH:MM:SS-SELECT CONVERT(VARCHAR(8), GETDATE(), 108)0.142280092592593
Mon DD YYYY HH:MI:SS:MMMAM (or PM) 1Default + SELECT CONVERT(VARCHAR(26), GETDATE(), 109)Apr 28 2006 12:32:29:253PM 1
MM-DD-YYUSASELECT CONVERT(VARCHAR(8), GETDATE(), 10) AS [MM-DD-YY]38718
MM-DD-YYYYUSASELECT CONVERT(VARCHAR(10), GETDATE(), 110) AS [MM-DD-YYYY]38718
YY/MM/DD-SELECT CONVERT(VARCHAR(8), GETDATE(), 11) AS [YY/MM/DD]98/11/23
YYYY/MM/DD-SELECT CONVERT(VARCHAR(10), GETDATE(), 111) AS [YYYY/MM/DD]36122
YYMMDDISOSELECT CONVERT(VARCHAR(6), GETDATE(), 12) AS [YYMMDD]980124
YYYYMMDDISOSELECT CONVERT(VARCHAR(8), GETDATE(), 112) AS [YYYYMMDD]19980124
DD Mon YYYY HH:MM:SS:MMM(24h) 1Europe default + millisecondsSELECT CONVERT(VARCHAR(24), GETDATE(), 113)28 Apr 2006 00:34:55:190 1
HH:MI:SS:MMM(24H)-SELECT CONVERT(VARCHAR(12), GETDATE(), 114) AS [HH:MI:SS:MMM(24H)]11:34:23:013
YYYY-MM-DD HH:MI:SS(24h)ODBC CanonicalSELECT CONVERT(VARCHAR(19), GETDATE(), 120)26299.5711111111
YYYY-MM-DD HH:MI:SS.MMM(24h)ODBC CanonicalSELECT CONVERT(VARCHAR(23), GETDATE(), 121)26348.2745889931
 (with milliseconds)  
YYYY-MM-DDTHH:MM:SS:MMMISO8601SELECT CONVERT(VARCHAR(23), GETDATE(), 126)1998-11-23T11:25:43:250
DD Mon YYYY HH:MI:SS:MMMAM 1KuwaitiSELECT CONVERT(VARCHAR(26), GETDATE(), 130)28 Apr 2006 12:39:32:429AM 1
DD/MM/YYYY HH:MI:SS:MMMAMKuwaitiSELECT CONVERT(VARCHAR(25), GETDATE(), 131)28/04/2006 12:39:32:429AM

Pozdrav
Ovaj komentar je mijenjan 1 puta. zadnja izmjena 09.12.2018-22:18 od strane zxz. ↑  ↓

#7 09.12.2018-22:30
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,818


Subject: Formati datuma
Formati datum Na MsSQL bazi:
DatumSQLizgled
YY-MM-DDSELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 8) AS [YY-MM-DD] SELECT REPLACE(CONVERT(VARCHAR(8), GETDATE(), 11), '/', '-') AS [YY-MM-DD]99-01-24
YYYY-MM-DDSELECT CONVERT(VARCHAR(10), GETDATE(), 120) AS [YYYY-MM-DD] SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 111), '/', '-') AS [YYYY-MM-DD]36184
MM/YYSELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 3), 5) AS [MM/YY] SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 3), 4, 5) AS [MM/YY] 36373
MM/YYYYSELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 103), 7) AS [MM/YYYY]38687
YY/MMSELECT CONVERT(VARCHAR(5), GETDATE(), 11) AS [YY/MM]99/08
YYYY/MMSELECT CONVERT(VARCHAR(7), GETDATE(), 111) AS [YYYY/MM]2005/12
Month DD, YYYY 1SELECT DATENAME(MM, GETDATE()) + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) AS [Month DD, YYYY]July 04, 2006 1
Mon YYYY 1SELECT SUBSTRING(CONVERT(VARCHAR(11), GETDATE(), 113), 4, 8) AS [Mon YYYY]Apr 2006 1
Month YYYY 1SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [Month YYYY]February 2006 1
DD Month 1SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) AS [DD Month]11 September 1
Month DD 1SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD]September 11 1
DD Month YY 1SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR(4)), 2) AS [DD Month YY]19 February 72 1
DD Month YYYY 1SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [DD Month YYYY]11 September 2002 1
MM-YYSELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 5), 5) AS [MM-YY]33939
 SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 5), 4, 5) AS [MM-YY] 
MM-YYYYSELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 105), 7) AS [MM-YYYY]38838
YY-MMSELECT RIGHT(CONVERT(VARCHAR(7), GETDATE(), 120), 5) AS [YY-MM] SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 5) AS [YY-MM]92/12
YYYY-MMSELECT CONVERT(VARCHAR(7), GETDATE(), 120) AS [YYYY-MM]2006-05
MMDDYYSELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '') AS [MMDDYY]122506
MMDDYYYYSELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), '/', '') AS [MMDDYYYY]12252006
DDMMYYSELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 3), '/', '') AS [DDMMYY]240702
DDMMYYYYSELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 103), '/', '') AS [DDMMYYYY]24072002
Mon-YY 1SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), GETDATE(), 6), 6), ' ', '-') AS [Mon-YY]Sep-02 1
Mon-YYYY 1SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY]Sep-2002 1
DD-Mon-YY 1SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), ' ', '-') AS [DD-Mon-YY]25-Dec-05 1
DD-Mon-YYYY 1SELECT REPLACE(CONVERT(VARCHAR(11), GETDATE(), 106), ' ', '-') AS [DD-Mon-YYYY]38711

Pozdrav
Ovaj komentar je mijenjan 1 puta. zadnja izmjena 09.12.2018-22:31 od strane zxz. ↑  ↓

Stranice (1): 1


All times are GMT +01:00. Current time: 13.12.2018-19:02.