MS-SQL etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
MS-SQL etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

Logo Tiger: Zaman bilgisinin Logo veritabanına integer olarak aktarılması

Logo Tiger'da, zaman bilgisi bazı tablolarda integer alanlarda tutulmaktadır. Bu alanları doldurmak için aşağıdaki SQL fonksiyonunu kullanabilirsiniz. (Veya aynı kodu C# veya Delphi gibi yazılım tool'larında hazırlayabilirsiniz)


CREATE FUNCTION [dbo].[LG_TIMETOINT](@HH INT,@MM INT,@SS INT)
       RETURNS INT
AS
BEGIN
 DECLARE @TIME    INT
 SELECT @TIME   = (@HH*65536*256+@MM*65536+@SS*256)
 RETURN(@TIME)
END

Örnek Kod:

-- Örneğin saat 15:54:00 olduğunda sonuç integer olarak  255197184 gelir
select [dbo].[LG_TIMETOINT](15,54,00) as IntegerSaat


NULL DBPROCESS pointer encountered, Delphi ZeosLib ile SQL server bağlantı sorunu

Delphi’de kullanılan ZeosLib kütüphanesi ile MSSQL server veritabanına bağlanırken

“NULL DBPROCESS pointer encountered” 

hatası alırsanız sırasıyla;

1. SQL Server Configuration Manager

2. SQL Server Network Configuration


3.Protocols for sağ klik à Flags à Force Encription = No olmalı  

Microsoft OLE DB Provider for SQL Server : Cannot create a row of size 8100 which is greater than the allowable maximum of 8060. (80040E14)

Microsoft OLE DB Provider for SQL Server : Cannot create a row of size 8100 which is greater than the allowable maximum of 8060. (80040E14)

hatası SQL 2000 server'ın bir tablodaki satır kapasitesinin 8060 byte olmasından kaynaklanmaktadır. SQL Server üzerinde bulunan tabloların kolon uzunluklarını bulan sorgudan sonra gerekli düzenleme yapılabilir.

Sorgu:


SELECT OBJECT_NAME(syscolumns.[id]) AS [Table Name] ,

SUM(syscolumns.length) AS [Row Size]

FROM syscolumns

JOIN sysobjects ON syscolumns.[id] = sysobjects.[id]

WHERE sysobjects.xtype = 'U' and OBJECT_NAME(syscolumns.[id]) like '%999%'

GROUP BY OBJECT_NAME(syscolumns.[id])


Sonuç:
Table Name
Row Size
BKP_LG_999_MRPHEAD
10192
LG_999_MRPHEAD
10192
LG_999_WHLIST
10046
BKP_LG_999_WHLIST
10046
LG_999_CLCARD
7194
BKP_LG_999_CLCARD
7194
BKP_LG_999_TAXDECLLINE
4950
LG_999_TAXDECLLINE
4950
LG_999_DEFNFLDSCARDV
2974
BKP_LG_999_DEFNFLDSCARDV
2974
LG_999_09_DEFNFLDSTRANV
2974
LG_999_11_DEFNFLDSTRANV
2974
LG_999_12_DEFNFLDSTRANV
2974
LG_999_10_DEFNFLDSTRANV
2974
LG_999_13_DEFNFLDSTRANV
2974
BKP_LG_999_CAMPAIGN
2937
LG_999_CAMPAIGN
2937

Logo Bordro Plus Personel Listesi SQL scripti

Bordro Plus üzerinde aktif ve pasif durumdaki personellere ait bilgilerin listesini aşağıdaki sorguyu kullanarak alabilirsiniz.



SELECT
CASE WHEN LGMAIN.TYP = 1 THEN 'AKTİF ÇALIŞAN' ELSE 'PASİF' END AS PERSONELDURUMU ,
LGMAIN.LREF,
LGMAIN.CODE As SicilNo,
LGMAIN.NAME as Adi,
LGMAIN.SURNAME as Soyadi,
LGMAIN.GROUPINDATE as GrubaGirisTarihi,
LGMAIN.INDATE as IseGirisTarihi,
LGMAIN.FIRMNR as KurumNo,
LGMAIN.UNITNR as BirimNo,
L_CAPIUNIT.NAME AS BirimAdi,
ASSG.TITLE as Gorevi,
LGMAIN.PREFIX AS AkademikUnvani,
CASE LAW.SSKSTATUS
      WHEN  1 THEN '4/a Normal'
      WHEN  2 THEN '4/a Emekli'
      WHEN  3 THEN '4/a Çırak'
      WHEN  4 THEN '4/a Stajyer'
      WHEN  5 THEN '4/a Yabancı'
      WHEN  6 THEN '4/b Bağ-kur(çalışan)'
      WHEN  7 THEN '4/b Bağ-kur(emekli)'
      WHEN  8 THEN 'Diğer'
      else 'Tanımsız'
end  as SosyalGuvenlikStatusu,
ASSG.WAGE_WAGE as Ucreti,
Case ASSG.WAGE_CLCTYPE
     WHEN 1 THEN 'Net'
     WHEN 2 THEN 'Brüt'
     ELSE 'Tanımsız'
END AS HesaplamaSekli,
'' as SozlesmeSekli,
INF.DADDY as BabaAdi,
INF.BIRTHPLACE AS DogumYeri,
INF.BIRTHDATE as DogumTarihi,  
CASE INF.STATUS
   WHEN 1 THEN 'Evli'
   WHEN 2 THEN 'Bekar'
   else 'Tanımsız'
end as MedeniHali,
CASE LGMAIN.SEX
   WHEN 1 THEN 'Erkek'
   WHEN 2 THEN 'Kadın'
   ELSE 'Tanımsız'
END AS Cinsiyeti,
CASE LGMAIN.EDUCATION
   WHEN 1 THEN 'İlkokul' WHEN 2 THEN 'Ortaokul' WHEN 3 THEN 'Lise' WHEN 4 THEN 'Yüksek' WHEN 5 THEN 'Yüksek Lisans' WHEN 6 THEN 'Doktora' ELSE 'Tanımsız'
END AS OgretimDurumu,
FINI.IbanNo as IbanNo,
ISNULL (ADRES.EXP1,' ') + ISNULL (ADRES.EXP2,' ')  AS Adres,
ISNULL (GSMNO.EXP1,' ') + ISNULL (GSMNO.EXP2,' ') AS CepNo,
LGMAIN.OUTDATE as CikisTarihi,
LGMAIN.SPECODE as OzelKod,
 INF.IDTCNO as TcKimlikNo,
 '1' AS CalismaAlani
 FROM
LH_001_PERSON LGMAIN WITH(NOLOCK)
LEFT OUTER JOIN LH_001_ASSIGN ASSG WITH(NOLOCK) ON (LGMAIN.LREF  =  ASSG.PERREF) AND (ASSG.ENDDATE IS NULL)
LEFT OUTER JOIN LH_001_PERFIN FINI WITH(NOLOCK) ON (LGMAIN.LREF  =  FINI.PERREF)
LEFT OUTER JOIN LH_001_FAMILY FAM ON   LGMAIN.LREF =   FAM.PERREF  AND RELATION = 0
LEFT OUTER JOIN LH_001_PERIDINF  INF ON   INF.LREF =   FAM.IDREF
LEFT OUTER JOIN LH_001_LAWCHG LAW ON (LGMAIN.LREF  =  LAW.PERREF)
LEFT OUTER JOIN LH_001_CONTACT ADRES (nolock) ON INF.[LREF] = ADRES.CARDREF AND ADRES.TYP = 1
LEFT OUTER JOIN LH_001_CONTACT GSMNO (nolock) ON INF.[LREF] = GSMNO.CARDREF AND GSMNO.TYP = 3
LEFT OUTER JOIN [dbo].L_CAPIUNIT (nolock) on L_CAPIUNIT.FIRMNR = 2 AND LGMAIN.UNITNR = L_CAPIUNIT.NR

Sonuç :

Tiger/Unity Hareket Özel Kodu Kontrol ve create işlemi

Tiger veya Unity üzerinde yapılan her türlü fişin satırlarında (Satınalma Sipariş, İrsaliye, Fatura, Malzeme Hareketi vs) "Hareket Özel Kodu" alanı bulunur.

Entegre bir sistem kurduğunuzda birbirinden bağımsız kurgulanan "Hareket Özel Kodları"'nın aynı kayıtlardan oluşabilmesi için bir Stored Procedure (SP) hazırladım. Amaç, Malzeme Fişi satırında açılan hareket özel kodunun tüm girişlerde görülmesini sağlamak. Aşağıdaki SP'yi, SQL Server üzerinde bir JOB'a bağlarsanız Hareket özel kodlarını sürekli güncel tutabilirsiniz.


Stored Procedure Kodu: 

Tiger'da Cari Hesaba Muhasebe hesap kodunu otomatik olarak aktarmak

Tiger'da Cari Hesaba Muhasebe hesap kodunu otomatik olarak aktarmak için aşağıdaki SQL scriptini çalıştırabilirsiniz.



DECLARE @carilref INT
DECLARE @carimuhlref INT
DECLARE @muhlref INT
DECLARE @carikodu varchar(50)
DECLARE @definiti varchar(50)
DECLARE @muhasebekodu varchar(50)

DECLARE @carimuhlref2 INT
DECLARE @muhlref2 INT
DECLARE @lastCarimuhSeq INT

DECLARE @eksikkayitsayisi INT



DECLARE processes CURSOR FOR
SELECT CARI.LOGICALREF,CARI.CODE AS CARI_KODU,CARIMUH.LOGICALREF AS CARIMUH_LREF,MUH.CODE AS MUHASEBE_KODU FROM LG_107_CLCARD CARI WITH (NOLOCK)
LEFT OUTER JOIN LG_107_CRDACREF CARIMUH WITH (NOLOCK) ON CARIMUH.CARDREF=CARI.LOGICALREF AND CARIMUH.TRCODE = 5
LEFT OUTER JOIN LG_107_EMUHACC MUH WITH (NOLOCK) ON CARIMUH.ACCOUNTREF=MUH.LOGICALREF
WHERE (MUH.CODE<>CARI.CODE OR MUH.CODE IS NULL) and SUBSTRING(CARI.CODE,5,2) = '47' AND CARI.CARDTYPE<>22 and CARI.CODE NOT LIKE '25%' ORDER BY CARI.CODE

OPEN processes
FETCH NEXT FROM processes
INTO @carilref,@carikodu,@carimuhlref,@muhasebekodu
WHILE @@FETCH_STATUS = 0
BEGIN
--ilk olarak LG_107_CRDACREF tablosunda kayıt var mı kontrol edilecek. eğer varsa ve muhasebe kodu yok veya hatalıysa muhasebe tablosundan
--kayıt aktarılacak.
set @muhlref2 = 0

SELECT @muhlref2=LOGICALREF FROM LG_107_EMUHACC where CODE = @carikodu
if @muhlref2 = 0
begin
insert into #EksikKayitTableGintem (Firma,CariKodu) values (107,@carikodu)
end
else
begin
if @carimuhlref IS NOT NULL
begin

UPDATE [LG_107_CRDACREF]
SET
[TRCODE] = 5
,[ACCOUNTREF] = @muhlref2
WHERE [LOGICALREF] = @carimuhlref
print 'update' + cast(@carimuhlref as varchar(20))
end
ELSE
BEGIN
print 'insert' + cast(@carimuhlref as varchar(20))
SELECT @lastCarimuhSeq = LASTLREF from LG_107_CRDACREFSEQ where ID=1
UPDATE LG_107_CRDACREFSEQ SET LASTLREF = @lastCarimuhSeq + 1 WHERE ID=1
INSERT INTO [LG_107_CRDACREF]
([LOGICALREF],[TRCODE],[CARDREF],[TYP],[ACCOUNTREF],[CENTERREF],[SITEID],[RECSTATUS],[ORGLOGICREF],[PROJECTREF])
VALUES (@lastCarimuhSeq ,5 ,@carilref,1 ,@muhlref2 ,1 ,0,0,0 ,0)
END
end

--PRINT cast(@muhlref2 as varchar(20)) + '-' + @carikodu


FETCH NEXT FROM processes
INTO @carilref,@carikodu,@carimuhlref,@muhasebekodu
END
CLOSE processes
DEALLOCATE processes

How to check if column exists in SQL Server table

CREATE FUNCTION ColumnExists(@TableName varchar(100), @ColumnName varchar(100))
RETURNS varchar(1) AS
BEGIN
DECLARE @Result varchar(1);
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = @TableName AND COLUMN_NAME = @ColumnName)
BEGIN
SET @Result = 'T'
END
ELSE
BEGIN
SET @Result = 'F'
END
RETURN @Result;
END
GO

GRANT EXECUTE ON [ColumnExists] TO [whoever]
GO

USAGE:
IF ColumnExists('LG_107_SPECODES', 'MARKA') = 'F'
BEGIN
ALTER TABLE LG_107_SPECODES
ADD MARKA varChar(50) NOT NULL
END
GO

Left Join with Distinct Statement in T-SQL

Problem:

SQL Left Join, it return multiple rows of the same items. I tried DISTINCT but that didnt work because its on Left Join. So my question how to add DISTINCT to Left Join?

Solution:
SELECT *
FROM dbo.LG_106_10_STLINE (NOLOCK) INNER JOIN
dbo.LG_106_ITEMS (NOLOCK) ON dbo.LG_106_10_STLINE.STOCKREF = dbo.LG_106_ITEMS.LOGICALREF LEFT OUTER JOIN
dbo.LG_106_10_STFICHE (NOLOCK) ON dbo.LG_106_10_STLINE.STFICHEREF = dbo.LG_106_10_STFICHE.LOGICALREF LEFT OUTER JOIN
dbo.LG_106_CLCARD (NOLOCK) ON dbo.LG_106_10_STFICHE.CLIENTREF = dbo.LG_106_CLCARD.LOGICALREF LEFT OUTER JOIN
dbo.L_CAPIDIV (NOLOCK) ON dbo.LG_106_10_STFICHE.BRANCH = dbo.L_CAPIDIV.NR LEFT OUTER JOIN
dbo.LG_106_SPECODES (nolock) LG_106_SPECODES_1
--This is I Changed
(select DISTINCT dbo.LG_106_SPECODES.SPECODE,dbo.LG_106_SPECODES.DEFINITION_ FROM dbo.LG_106_SPECODES (NOLOCK)) LG_106_SPECODES_1 ON dbo.LG_106_ITEMS.STGRPCODE = LG_106_SPECODES_1.SPECODE LEFT OUTER JOIN
dbo.L_TRADGRP (NOLOCK) ON dbo.LG_106_10_STFICHE.TRADINGGRP = dbo.L_TRADGRP.GCODE LEFT OUTER JOIN
dbo.LG_106_SPECODES LG_106_SPECODES_2 (NOLOCK) ON dbo.LG_106_10_STLINE.DELVRYCODE = LG_106_SPECODES_2.SPECODE LEFT OUTER JOIN
LG_106_PROJECT (NOLOCK) ON LG_106_10_STLINE.PROJECTREF = LG_106_PROJECT.LOGICALREF LEFT OUTER JOIN
dbo.LG_106_10_INVOICE (NOLOCK) ON dbo.LG_106_10_STFICHE.INVOICEREF = dbo.LG_106_10_INVOICE.LOGICALREF
WHERE (dbo.LG_106_10_STFICHE.TRCODE IN (12)) AND
(LG_106_SPECODES_2.SPECODETYPE IS NULL OR LG_106_SPECODES_2.SPECODETYPE = 0)
AND (dbo.L_CAPIDIV.FIRMNR = 106)

Parayı/Rakamı yazıya çeviren SQL Function

-- Name: Parayı/Rakamı yazıya çeviren SQL function
-- Description:
--sayısal değeri yazıya çevirir
--virgülden sonra 2 haneyi alır
--Eğer @isMoney = true ise dönüş değerine TL ve kuruş eklenir
create function dbo.fnc_ParayiYaziyaCevir (@num AS numeric(18,2), @isMoney as bit)
returns varchar(255)
AS
BEGIN

--declare @num numeric(18,2)
--declare @isMoney bit
--set @num = 1001111.99
--set @isMoney = 1
DECLARE @Split tinyint
DECLARE @iSplit tinyint
DECLARE @sNum varchar(20)
DECLARE @NumSet varchar(3)
DECLARE @Char char(1)
DECLARE @NumText varchar(255)
DECLARE @SetText varchar(100)
DECLARE @HunText varchar(100)
DECLARE @CharText varchar(50)
DECLARE @Match bit
DECLARE @Point tinyint
DECLARE @Cents varchar(2)
DECLARE @CentText varchar(100)
DECLARE @NumStrings TABLE (Num int, NumStr varchar(20))
INSERT INTO @NumStrings
SELECT 1, 'Bir'
UNION SELECT 2, 'İki'
UNION SELECT 3, 'Üç'
UNION SELECT 4, 'Dört'
UNION SELECT 5, 'Beş'
UNION SELECT 6, 'Altı'
UNION SELECT 7, 'Yedi'
UNION SELECT 8, 'Sekiz'
UNION SELECT 9, 'Dokuz'
UNION SELECT 10, 'On'
UNION SELECT 11, 'Onbir'
UNION SELECT 12, 'Oniki'
UNION SELECT 13, 'Onüç'
UNION SELECT 14, 'Ondört'
UNION SELECT 15, 'Onbeş'
UNION SELECT 16, 'Onaltı'
UNION SELECT 17, 'Onyedi'
UNION SELECT 18, 'Onsekiz'
UNION SELECT 19, 'Ondokuz'
UNION SELECT 20, 'Yirmi'
UNION SELECT 30, 'Otuz'
UNION SELECT 40, 'Kırk'
UNION SELECT 50, 'Elli'
UNION SELECT 60, 'Altmış'
UNION SELECT 70, 'Yetmiş'
UNION SELECT 80, 'Seksen'
UNION SELECT 90, 'Doksan'
SET @sNum = cast(@num as varchar(20))
--convert any cent text first, then the
-- whole number
SET @Point = charindex('.', @sNum)
IF @Point > 0
BEGIN
SET @Cents = substring(@sNum, @Point + 1, 2)
SET @sNum = left(@sNum, @Point-1)
--if isMoney THEN combine the two digits (eg 11 = eleven)
IF @isMoney = 1
BEGIN --look FOR matches WITH the RIGHT İki characters
SET @Match = (select count(*) FROM @NumStrings WHERE Num = @Cents)
IF @Match <> 0
BEGIN
SET @CentText = (select NumStr FROM @NumStrings WHERE Num = @Cents)
END
ELSE
BEGIN
SET @CentText = isnull((select NumStr FROM @NumStrings WHERE Num = left(@Cents, 1) + '0'),'') + (select NumStr from @NumStrings where Num = right(@Cents, 1))
END
END
ELSE --if NOT isMBiry THEN treat each digit seperately (eg 11 = Bir Bir)
BEGIN
SET @CentText = isnull((select NumStr FROM @NumStrings WHERE Num = left(@Cents, 1)),'') + isnull((select NumStr from @NumStrings where Num = right(@Cents, 1)),'')
END
END
IF @CentText IS NULL
SET @CentText = ''
--break the number into blocks of 3 characters
SET @Split = ((len(@sNum)-1) / 3) + 1
SET @iSplit = 0
SET @NumText = ''
WHILE @iSplit < @Split
BEGIN
SET @CharText = ''
SET @HunText = ''
SET @SetText = ''
SET @NumSet = right(left(@sNum, len(@sNum) - @iSplit * 3), 3)
IF len(@Numset) = 3 --Calculate ANY hundreds
BEGIN
SET @Char = left(@NumSet, 1)
if @Char='1'
SET @HunText = 'Yüz'
ELSE
SET @HunText = isnull((select NumStr FROM @NumStrings WHERE Num = @Char) + 'Yüz', '')
SET @SetText = @HunText
END
--look FOR matches WITH the RIGHT two characters
SET @Match = (select count(*) FROM @NumStrings WHERE Num = right(@NumSet, 2))
IF @Match <> 0
BEGIN
SET @CharText = (select NumStr FROM @NumStrings WHERE Num = right(@NumSet, 2))
END
ELSE
BEGIN
SET @CharText = isnull((select NumStr FROM @NumStrings WHERE Num = left(right(@NumSet, 2), 1) + '0'),'') + (select NumStr from @NumStrings where Num = right(@NumSet, 1))
END
--make sure there IS something in @CharText AND @SetText (ie IF @NumSet = x00, x000)
IF @CharText IS NULL SET @CharText = ''
IF @SetText IS NULL set @SetText = ''
--seperate ANY hundreds FROM Ons/units WITH an 'and'
IF @HunText <> '' AND @CharText <> ''
SET @SetText = @SetText + ''
--if there are no hundreds, it's the smallest SET AND there are other sets, ADD an 'and' before
IF @HunText = '' AND @CharText <> '' and @iSplit = 0 and @Split > 1 and @CentText = ''
SET @SetText = '' + @SetText
SET @SetText = @SetText + @CharText
--append the SET suffix text. ADD a ',' AS long as there IS something in the lowest set
if @iSplit = 1 AND @SetText='Bir' BEGIN
SET @SetText=''
SET @SetText = @SetText + CASE @iSplit
WHEN 0 THEN ''
WHEN 1 THEN 'Bin'
WHEN 2 THEN 'Milyon'
WHEN 3 THEN 'Milyar'
WHEN 4 THEN 'Trilyon'
WHEN 5 THEN 'Katrilyon'
END + CASE WHEN len(@NumText) > 0 THEN '' ELSE '' end
END
ELSE
BEGIN
IF @SetText <> ''
SET @SetText = @SetText + CASE @iSplit
WHEN 0 THEN ''
WHEN 1 THEN 'Bin'
WHEN 2 THEN 'Milyon'
WHEN 3 THEN 'Milyar'
WHEN 4 THEN 'Trilyon'
WHEN 5 THEN 'Katrilyon'
END + CASE WHEN len(@NumText) > 0 THEN '' ELSE '' end
END
SET @NumText = @SetText + @NumText
SET @iSplit = @iSplit + 1
END
--add any dollars and cent text
IF @isMoney = 1 AND @NumText <> '' and rtrim(ltrim(@NumText)) <> 'Bir'
SET @NumText = @NumText + ' TL'
IF @isMoney = 1 AND rtrim(ltrim(@NumText)) = 'Bir'
SET @NumText = @NumText + ' TL'
IF @isMoney = 1 AND @CentText <> '' and rtrim(ltrim(@CentText)) <> 'Bir'
SET @CentText = @CentText + ' kuruş'
IF @isMoney = 1 AND rtrim(ltrim(@CentText)) = 'Bir'
SET @CentText = @CentText + ' kuruş'
IF @isMoney = 0 AND @CentText <> ''
SET @CentText = ' Point' + @CentText
IF @isMoney = 1 AND @NumText <> '' and @CentText <> ''
SET @CentText = ' ' + @CentText
--combine dollars and cents
SET @NumText = @NumText + @CentText
--add 'Minus' for negative numbers
IF left(@sNum, 1) = '-'
SET @NumText = 'virgül' + @NumText
RETURN @NumText
END

Saving SQL Query Results as HTML



USE:
declare @rc int

declare @MessageText VARCHAR(8000)

--section -1- SaveTableAsHTML
EXECUTE SaveTableAsHTML
@DBFetch = 'SELECT MektupGecerlilikTarihi,IhaleKayitNo,KurumAdi,IsinAdi,BankaAdi,MektupTipi,MektupTutari FROM
VW_TEMINAT_MEKTUPLARI_LISTESI_HAFTALIK_MAIL ',
@DBWhere = ' 1=1 ',
@TableStyle=' font-size: 11px; color: black; font-family: verdana; table-layout: auto; width: 83%;
border-collapse: collapse; border-right: black thin double; border-top: black thin double; border-left: black thin double;
border-bottom: black thin double; '
,@Header = 1, @outputText=@MessageText OUTPUT

-- section -2- Send Mail

exec @rc = master.dbo.xp_smtp_sendmail
@FROM = N'Sqlmailservice@gintem.com.tr',
@FROM_NAME = N'SQL Mail Service - Teminat Mektupları',
@replyto = N'',
@TO = N'serkansonmez@gintem.com.tr',
@CC = N'',
@BCC = N'',
@priority = N'NORMAL',
@subject = N'15 gün içinde Vadesi Dolacak Teminat Mektupları' ,
@message = @MessageText,
@type = N'text/html',
@messagefile= N'',
@attachment = N'',
@attachments= N'',
@timeout = 10000,
@server = N'mail.gintem.com.tr'
select RC = @rc
go
 
RETURN VALUE:

MektupGecerlilikTarihi
IhaleKayitNo
KurumAdi
IsinAdi
BankaAdi
MektupTipi
MektupTutari
03/01/2009
-
İZSU
WİNWİN
DENIZBANK
Geçici
349000.00

-- SaveTableAsHTML.sql

if exists (select * from dbo.sysobjects where id = object_id(N`[dbo].[SaveTableAsHTML]`) and OBJECTPROPERTY(id, N`IsProcedure`) = 1)
drop procedure [dbo].[SaveTableAsHTML]
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

/*
SaveTableAsHTML.sql
http://www.virtualobjectives.com.au
http://www.serkansonmez.com

History:
27/02/2009 - John Buoro - Created.
31/03/2009 - John Buoro - OSQL replaces BCP as query length of BCP is limited to only 1023 chars.
14/11/2009 - Serkan SONMEZ - add new OutputText parameter which return to html code
*/

CREATE PROCEDURE dbo.SaveTableAsHTML
@PCWrite varchar(1000) = NULL,
@DBFetch varchar(4000),
@DBWhere varchar(2000) = NULL,
@DBThere varchar(2000) = NULL,
@DBUltra bit = 1,
@TableStyle varchar(1000) = `border-width: thin; border-spacing: 2px; border-style: solid; border-color: gray; border-collapse: collapse;`,
@Header bit = 1,-- Output header. Default is 1.
@OutputText varchar(8000) OUTPUT
AS

SET NOCOUNT ON
SET @OutputText = ``
DECLARE @Return int
DECLARE @Retain int
DECLARE @Status int

SET @Status = 0

DECLARE @TPre varchar(10)

DECLARE @TDo3 tinyint
DECLARE @TDo4 tinyint

SET @TPre = ``

SET @TDo3 = LEN(@TPre)
SET @TDo4 = LEN(@TPre) + 1

DECLARE @DBAE varchar(40)
DECLARE @Task varchar(6000)
DECLARE @Bank varchar(4000)
DECLARE @Cash varchar(2000)
DECLARE @Risk varchar(2000)
DECLARE @Next varchar(8000)
DECLARE @Save varchar(8000)
DECLARE @Work varchar(8000)
DECLARE @Wish varchar(8000)
DECLARE @hString varchar(8000)
DECLARE @tString varchar(8000)
DECLARE @fString varchar(50)

DECLARE @Name varchar(100)
DECLARE @Same varchar(100)

DECLARE @Rank smallint
DECLARE @Kind varchar(20)
DECLARE @Mask bit
DECLARE @Bond bit
DECLARE @Size int
DECLARE @Wide smallint
DECLARE @More smallint

DECLARE @DBAI varchar(2000)
DECLARE @DBAO varchar(8000)
DECLARE @DBAU varchar(8000)

DECLARE @Fuse int
DECLARE @File int

DECLARE @FuseO int
DECLARE @FileO int
DECLARE @TmpPathObj int
DECLARE @TmpPath varchar(127)
DECLARE @TmpFile varchar(127)
DECLARE @TmpFilename varchar(1000)

DECLARE @HeaderString varchar(8000)
DECLARE @sHeaderString varchar(8000)
DECLARE @HeaderDone int

SET @DBAE = `##SaveFile` + RIGHT(CONVERT(varchar(10),@@SPID+100000),5)

SET @Task = `IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = ` + CHAR(39) + @DBAE + CHAR(39) + `) DROP TABLE ` + @DBAE
EXECUTE (@Task)

SET @Bank = @TPre + @DBFetch

IF NOT EXISTS (SELECT * FROM sysobjects WHERE RTRIM(type) = `U` AND name = @Bank)
BEGIN
SET @Bank = CASE WHEN LEFT(LTRIM(@DBFetch),6) = `SELECT` THEN `(` + @DBFetch + `)` ELSE @DBFetch END
SET @Bank = REPLACE(@Bank, CHAR(94),CHAR(39))
SET @Bank = REPLACE(@Bank,CHAR(45)+CHAR(45),CHAR(32))
SET @Bank = REPLACE(@Bank,CHAR(47)+CHAR(42),CHAR(32))
END

IF @DBWhere IS NOT NULL
BEGIN
SET @Cash = REPLACE(@DBWhere,`WHERE` ,CHAR(32))
SET @Cash = REPLACE(@Cash, CHAR(94),CHAR(39))
SET @Cash = REPLACE(@Cash,CHAR(45)+CHAR(45),CHAR(32))
SET @Cash = REPLACE(@Cash,CHAR(47)+CHAR(42),CHAR(32))
END

IF @DBThere IS NOT NULL
BEGIN
SET @Risk = REPLACE(@DBThere,`ORDER BY` ,CHAR(32))
SET @Risk = REPLACE(@Risk, CHAR(94),CHAR(39))
SET @Risk = REPLACE(@Risk,CHAR(45)+CHAR(45),CHAR(32))
SET @Risk = REPLACE(@Risk,CHAR(47)+CHAR(42),CHAR(32))
END

SET @DBAI = ``
SET @DBAO = ``
SET @DBAU = ``

IF ASCII(LEFT(@Bank,1)) < 64 BEGIN SET @Task = `SELECT * INTO ` + @DBAE + ` FROM ` + @Bank + ` AS T WHERE 0 = 1` IF @Status = 0 EXECUTE (@Task) SET @Return = @@ERROR IF @Status = 0 SET @Status = @Return DECLARE Fields CURSOR FAST_FORWARD FOR SELECT C.name, C.colid, T.name, C.isnullable, C.iscomputed, C.length, C.prec, C.scale FROM tempdb.dbo.sysobjects AS O JOIN tempdb.dbo.syscolumns AS C ON O.id = C.id JOIN tempdb.dbo.systypes AS T ON C.xusertype = T.xusertype WHERE O.name = @DBAE ORDER BY C.colid SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain END ELSE BEGIN DECLARE Fields CURSOR FAST_FORWARD FOR SELECT C.name, C.colid, T.name, C.isnullable, C.iscomputed, C.length, C.prec, C.scale FROM sysobjects AS O JOIN syscolumns AS C ON O.id = C.id JOIN systypes AS T ON C.xusertype = T.xusertype WHERE ISNULL(OBJECTPROPERTY(O.id,`IsMSShipped`),1) = 0 AND RTRIM(O.type) IN (`U`,`V`,`IF`,`TF`) AND O.name = @Bank ORDER BY C.colid SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain END OPEN Fields SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain FETCH NEXT FROM Fields INTO @Same, @Rank, @Kind, @Mask, @Bond, @Size, @Wide, @More SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain -- Convert to character for header. SET @HeaderString = `` SET @sHeaderString = `` declare @sql nvarchar(4000) declare @aHeader nvarchar(9) declare @zHeader nvarchar(9) set @aHeader = ``
set @zHeader = ``

WHILE @@FETCH_STATUS = 0 AND @Status = 0
BEGIN
-- Build header.
IF LEN(@HeaderString) > 0 SET @HeaderString = @HeaderString + `+lower(````)` + `+ISNULL(``` + @Same + ```,SPACE(0))+` + `lower(````)+`
IF LEN(@HeaderString) = 0 SET @HeaderString = `+lower(````)` + `+ISNULL(``` + @Same + ```,SPACE(0))+` + `lower(````)+`
IF LEN(@sHeaderString) > 0 SET @sHeaderString = @sHeaderString + @aHeader + ISNULL(@Same, SPACE(0)) + @zHeader
IF LEN(@sHeaderString) = 0 SET @sHeaderString = @aHeader + ISNULL(@Same, SPACE(0)) + @zHeader

IF @Kind IN (`char`,`varchar`,`nchar`,`nvarchar`)
BEGIN
IF @Rank = 1 SET @DBAU = `lower(````)` + `+ISNULL(CONVERT(varchar(40),` + @Same + `),SPACE(0))+` + `lower(````)`
IF @Rank > 1 SET @DBAU = @DBAU + `+lower(````)` + `+ISNULL(CONVERT(varchar(40),` + @Same + `),SPACE(0))+` + `lower(````)`
END

IF @Kind IN (`bit`,`tinyint`,`smallint`,`int`,`bigint`)
BEGIN
IF @Rank = 1 SET @DBAU = `lower(````)` + `+ISNULL(CONVERT(varchar(40),` + @Same + `),SPACE(0))+` + `lower(````)`
IF @Rank > 1 SET @DBAU = @DBAU + `+lower(````)` + `+ISNULL(CONVERT(varchar(40),` + @Same + `),SPACE(0))+` + `lower(````)`
END

IF @Kind IN (`numeric`,`decimal`,`money`,`smallmoney`,`float`,`real`)
BEGIN
IF @Rank = 1 SET @DBAU = `lower(````)` + `+ISNULL(CONVERT(varchar(80),` + @Same + `),SPACE(0))+` + `lower(````)`
IF @Rank > 1 SET @DBAU = @DBAU + `+lower(````)` + `+ISNULL(CONVERT(varchar(80),` + @Same + `),SPACE(0))+` + `lower(````)`
END

IF @Kind IN (`uniqueidentifier`)
BEGIN
IF @Rank = 1 SET @DBAU = `lower(````)` + `+ISNULL(CONVERT(varchar(80),` + @Same + `),SPACE(0))+` + `lower(````)`
IF @Rank > 1 SET @DBAU = @DBAU + `+lower(````)` + `+ISNULL(CONVERT(varchar(80),` + @Same + `),SPACE(0))+` + `lower(````)`
END

IF @Kind IN (`datetime`,`smalldatetime`)
BEGIN
IF @Rank = 1 SET @DBAU = `lower(````)` + `+ISNULL(CONVERT(varchar(40),` + @Same + `,103),SPACE(0))+` + `lower(````)`
IF @Rank > 1 SET @DBAU = @DBAU + `+lower(````)` + `+ISNULL(CONVERT(varchar(40),` + @Same + `,103),SPACE(0))+` + `lower(````)`
END

FETCH NEXT FROM Fields INTO @Same, @Rank, @Kind, @Mask, @Bond, @Size, @Wide, @More
SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain
END

CLOSE Fields DEALLOCATE Fields

IF LEN(@DBAU) = 0 SET @DBAU = `*`

SET @DBAI = ` SELECT `
SET @DBAO = ` FROM ` + @Bank + ` AS T`
+ CASE WHEN @DBWhere IS NULL THEN `` ELSE ` WHERE (` + @Cash + `) AND 0 = 0` END
+ CASE WHEN @DBThere IS NULL THEN `` ELSE ` ORDER BY ` + @Risk + `,` + CHAR(39) + `DBA` + CHAR(39) END

IF LEN(ISNULL(@PCWrite,`*`)) > 7 AND @DBUltra = 0
BEGIN
SET @tString = ` select lower(``< html>< body>`` UNION ALL ` SET @fString = ` UNION ALL select ````` SET @hString = `` IF @Header = 1 BEGIN SET @hString = ` select ``` + @sHeaderString + ``` UNION ALL ` END SET @Wish = `set nocount on; USE ` + DB_NAME() + @tString + @hString + @DBAI + `````+` + @DBAU + `+````` + @DBAO + @fString -- SET @Work = `bcp "` + @Wish + `" queryout "` + @PCWrite + `" -c -T` -- Query length of BCP is limited to only 1023 chars. -- Create SQL script file. IF @Status = 0 EXECUTE @Status = sp_OACreate `Scripting.FileSystemObject`, @FuseO OUTPUT IF @Status = 0 EXECUTE @Status = sp_OAGetProperty @FuseO, `GetSpecialFolder(2)`, @TmpPathObj OUTPUT IF @Status = 0 EXECUTE @Status = sp_OAGetProperty @TmpPathObj, `Path`, @TmpPath OUTPUT IF @Status = 0 EXECUTE @Status = sp_OAGetProperty @FuseO, `GetTempName`, @TmpFile OUTPUT SET @TmpFilename = @TmpPath + `\` + @TmpFile IF @Status = 0 EXECUTE @Status = sp_OAMethod @FuseO, `CreateTextFile`, @FileO OUTPUT, @TmpFilename, -1 IF @Status <> 0 GOTO ABORT IF @Status = 0 EXECUTE @Status = sp_OAMethod @FileO, `Write`, NULL, @Wish IF @Status = 0 EXECUTE @Status = sp_OAMethod @FileO, `Close` SET @Work = `osql -i "` + @TmpFilename + `" -o "` + @PCWrite + `" -n -h-1 -w8000 -E` EXECUTE @Return = master.dbo.xp_cmdshell @Work, NO_OUTPUT SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain IF @Status = 0 SET @Status = @Return EXECUTE @Status = sp_OAMethod @FuseO, `DeleteFile`, NULL, @TmpFilename EXECUTE @Status = sp_OADestroy @FuseO GOTO ABORT END IF LEN(ISNULL(@PCWrite,`*`)) > 7 BEGIN IF @Status = 0 EXECUTE @Return = sp_OACreate `Scripting.FileSystemObject`, @Fuse OUTPUT SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain IF @Status = 0 SET @Status = @Return IF @Status = 0 EXECUTE @Return = sp_OAMethod @Fuse, `CreateTextFile`, @File OUTPUT, @PCWrite, -1 SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain IF @Status = 0 SET @Status = @Return IF @Status <> 0 GOTO ABORT END SET @DBAI = `DECLARE Records CURSOR GLOBAL FAST_FORWARD FOR` + @DBAI IF @Status = 0 EXECUTE (@DBAI+@DBAU+@DBAO) SET @Return = @@ERROR IF @Status = 0 SET @Status = @Return OPEN Records SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain FETCH NEXT FROM Records INTO @Next SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain SET @HeaderDone = 0 WHILE @@FETCH_STATUS = 0 AND @Status = 0 BEGIN SET @Save = `` IF ISNULL(@File,0) = 0 BEGIN -- Print header (TEXT). IF @HeaderDone = 0 BEGIN SET @OutputText = @OutputText + `
` + CHAR(13) + CHAR(10) SET @HeaderDone = 1 END IF @Header = 1 BEGIN SET @OutputText = @OutputText + `` + @sHeaderString + `` + CHAR(13) + CHAR(10) SET @Header = 0 END SET @OutputText = @OutputText + `` + @Next + `` END ELSE BEGIN -- Print header (FILE). IF @HeaderDone = 0 BEGIN SET @Save = @Save + `` + CHAR(13) + CHAR(10) SET @HeaderDone = 1 END IF @Header = 1 BEGIN SET @Save = @Save + `` + @sHeaderString + `` + CHAR(13) + CHAR(10) SET @Header = 0 END -- Print the data. SET @Save = @Save + `` + @Next + `` + CHAR(13) + CHAR(10) IF @Status = 0 EXECUTE @Return = sp_OAMethod @File, `Write`, NULL, @Save IF @Status = 0 SET @Status = @Return END FETCH NEXT FROM Records INTO @Next SET @Retain = @@ERROR IF @Status = 0 SET @Status = @Retain END CLOSE Records DEALLOCATE Records -- Print footer (TEXT). IF ISNULL(@File,0) = 0 BEGIN SET @OutputText = @OutputText + `
` + CHAR(13) + CHAR(10) END ELSE BEGIN SET @Save = `` + CHAR(13) + CHAR(10) IF @Status = 0 EXECUTE @Return = sp_OAMethod @File, `Write`, NULL, @Save END -- Close. IF ISNULL(@File,0) <> 0 BEGIN EXECUTE @Return = sp_OAMethod @File, `Close`, NULL IF @Status = 0 SET @Status = @Return EXECUTE @Return = sp_OADestroy @File IF @Status = 0 SET @Status = @Return EXECUTE @Return = sp_OADestroy @Fuse IF @Status = 0 SET @Status = @Return END ABORT: -- This label is referenced when OLE automation fails. IF @Status = 1 OR @Status NOT BETWEEN 0 AND 50000 RAISERROR (`SaveTableAsHTML Windows error [%d]`,16,1,@Status) SET @Task = `IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = ` + CHAR(39) + @DBAE + CHAR(39) + `) DROP TABLE ` + @DBAE EXECUTE (@Task) SET NOCOUNT OFF RETURN (@Status) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO

Get dates from week number in T-SQL

In Microsoft SQL Server, I have a week number
for example;










SELECT DATEPART(wk, GETDATE())  -- today 05.11.2009
result : 45

Only Date Part to GetDate() function in SQL Server

Problem:
I want to getdate() function to compare datetime field.  Date part of both field (2009-10-15 ) but not equal. 

SELECT getdate(),* from GUNLUK_GELENLER WHERE Per_ZeitStatusDatum = getdate()
--No Result

SOLUTION:

SELECT getdate(),* from GUNLUK_GELENLER WHERE
CONVERT(VARCHAR(10),Per_ZeitStatusDatum,111) =
CONVERT(VARCHAR(10),GETDATE(),111)

Insert Values of Stored Procedure in Table or Table Valued Function

I think different ways to insert the values from a stored procedure into a table. Let us quickly look at the conventional way of doing the same.

/* Create Stored Procedure */
CREATE PROCEDURE TestSP
AS

SELECT GETDATE() AS MyDate, 1 AS IntValue
UNION ALL
SELECT GETDATE()+1 AS MyDate, 2 AS IntValue
GO


Traditional Method:

/* Create TempTable */
CREATE TABLE #tempTable (MyDate SMALLDATETIME, IntValue INT)
GO
/* Run SP and Insert Value in TempTable */
INSERT INTO #tempTable (MyDate, IntValue)
EXEC TestSP
GO
/* SELECT from TempTable */
SELECT * FROM #tempTable
GO
/* Clean up */
DROP TABLE #tempTable
GO

Alternate Method: Table Valued Function

/* Create table valued function*/
CREATE FUNCTION dbo.TestFn()
RETURNS @retTestFn TABLE
(MyDate SMALLDATETIME,IntValue INT)
AS
BEGIN
DECLARE @MyDate SMALLDATETIME
DECLARE @IntValue INT
INSERT INTO @retTestFn
SELECT GETDATE() AS MyDate, 1 AS IntValue
UNION ALL
SELECT GETDATE()+1 AS MyDate, 2 AS IntValue
RETURN;
END
GO
/* Select data from Table Valued Function */
SELECT *FROM dbo.TestFn()
GO

It is clear from the resultset that option 2, where I have converted stored procedures logic into the table valued function, is much better in terms of logic as it saves a large number of operations. However, this option should be used carefully. Performance of the stored procedure is “usually” better than that of functions.


Reference : Pinal Dave (http://blog.sqlauthority.com/ )

Prevent multi-row updates with Trigger

The best way to do this would be with a trigger :

create trigger trig_single_updates_only on table_name
for update
as
begin
if (select count(*) from inserted) > 1
begin
raiserror ('You cannot update more than one row at time - please add an appropriete where clause',16,1)
rollback
end
end

How to prevent duplication record?

You can use either of the following Approach:

1. Basically Creating a Unique Constraint suffice.
2. Creating Unique index (Unique Constraint + Index) would help you in case of frequent querying based upon that column.
3. Creating an Identity column to avoid duplication.

Transaction log in sql server

could be a few things affecting... are the transaction logs under a maintenance plan of some description where full backups and frequent ttransaction logs backups for a FULL recovery mode database, or, maybe you are using SIMPLE recovery mode.

do you run a shrink or some other "clean up" process ? has the database files been analysed and optimised for a size and growth ? Is there sufficient disk space ? has the lof been allowed to grow (obviously not), what is the current size ?

all these types of things might come into play as well... not necessarily just a "rogue/unruley/hungry" process sending it into a spin...

one thing you can do if you notice and increase in size:

DBCC OPENTRAN

it will show you the open transactions and the SPID's associated. You can then track back to the SPID's and see the SQL that they are using at the time.

you could automate the whole lot in a stored procedure and schedule it to run every so often... have a look at a couple of code snippets below...



--capture logspace into a table (and a general approach for collecting dbcc outputs)
create table tmp_sqlperf(databaseName varchar(100),LogSize decimal(18,5),LogSpace decimal(18,5),Status int)

insert tmp_sqlperf
exec ( 'dbcc sqlperf (logspace)')
select * from tmp_sqlperf


--check current log activity
select * from fn_dblog(NULL,NULL)
--or
dbcc log('MY_DB',-1)


--check current SPID's with opentrans
dbcc opentran

--capture the SQL /processes belonging to a specific spid
DECLARE @Handle binary(20)
SELECT @Handle = sql_handle FROM master.dbo.sysprocesses WHERE spid = 57
SELECT * FROM ::fn_get_sql(@Handle)
--or
select * from sys.dm_exec_sql_text(@handle)
Open in New Window Select All Not what you're looking for? Ask an Expert.

8152 - String or binary data would be truncated.

Server: Msg 8152, Level 16, State 14, Line 1
String or binary data would be truncated.
The statement has been terminated.

This error happen when I tried to insert a value too long in a varchar or nvarchar
column:

CREATE TABLE TableName_(id VARCHAR(2))
go

INSERT TableName_ VALUES ('Serkan')

Resolution:
1- Most programmers are lazy they prefer not to change code (and introduce bugs)
INSERT bla VALUES (LEFT('123',2))
2 - Here is one way to do it without changing code but by setting ANSI Warnings to off

SET ANSI_WARNINGS OFF
INSERT TableName_ VALUES ('Serkan')
SET ANSI_WARNINGS ON
--set it back on so code following this won't be messed up

MS SQL Server: Disconnect Users From Database with KILL SID (Kill User Session)

You can delete all the active session with the following query.


DECLARE @spid INT
DECLARE @query NVARCHAR(255)

DECLARE processes CURSOR FOR
SELECT spid FROM master..sysprocesses
WHERE dbid = DB_ID('Your_Database_Name')
AND spid != @@SPID
OPEN processes
FETCH NEXT FROM processes
INTO @spid
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'KILLING '+RTRIM(@spid)
SET @query = 'KILL '+RTRIM(@spid)
EXEC(@query)
FETCH NEXT FROM processes
INTO @spid
END
CLOSE processes
DEALLOCATE processes

Msg 15281, Level 16, State 1, Procedure sp_send_dbmail, Line 0

ERROR MESSAGE:
Msg 15281, Level 16, State 1, Procedure sp_send_dbmail, Line 0
SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Database Mail XPs' by using sp_configure. For more information about enabling 'Database Mail XPs', see "Surface Area Configuration" in SQL Server Books Online.


RESOLUTION:
We have to enable the Database Mail feature on the server. In the SQL Server Management Studio to use Transact SQL to enable Database Mail, execute the following statement.

use master
go
sp_configure ’show advanced options’,1
go
reconfigure with override
go
sp_configure ‘Database Mail XPs’,1
–go
–sp_configure ‘SQL Mail XPs’,0
go
reconfigure
go

Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
Configuration option 'Database Mail XPs' changed from 0 to 1. Run the RECONFIGURE statement to install.
Configuration option 'show advanced options' changed from 1 to 0. Run the RECONFIGURE statement to install.

How can be used to remove all database pages and clear cache from the memory in SQL Server?

Use DBCC FREEPROCCACHE to clear the procedure cache. Freeing the procedure cache would cause, for example, an ad-hoc SQL statement to be recompiled rather than reused from the cache. If observing through SQL Profiler, one can watch the Cache Remove events occur as DBCC FREEPROCCACHE goes to work. DBCC FREEPROCCACHE will invalidate all stored procedure plans that the optimizer has cached in memory and force SQL Server to compile new plans the next time those procedures are run.

Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server. DBCC DROPCLEANBUFFERS serves to empty the data cache. Any data loaded into the buffer cache due to the prior execution of a query is removed.

DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS

2018 SGK İşten Çıkış Kodları (696 sayılı KHK kapsamında eklenenler dahil)

2018 SGK İşten Çıkış Kodları 1- Deneme süreli iş sözleşmesinin işverence feshi 2- Deneme süreli iş sözleşmesinin işçi tarafından feshi ...