{"id":75,"date":"2016-02-10T13:41:11","date_gmt":"2016-02-10T13:41:11","guid":{"rendered":"http:\/\/uysalyilmaz.com\/wordpress\/?p=75"},"modified":"2016-02-10T13:42:59","modified_gmt":"2016-02-10T13:42:59","slug":"truncate-table-foreign-key-varken","status":"publish","type":"post","link":"http:\/\/uysalyilmaz.com\/index.php\/2016\/02\/10\/truncate-table-foreign-key-varken\/","title":{"rendered":"Truncate Table  Foreign Key varken"},"content":{"rendered":"<pre class=\"lang:tsql decode:true  \">DECLARE @TableName NVARCHAR(128)='TabloAdi'\r\n\r\nBEGIN TRAN\r\n\r\nDECLARE @NextId NUMERIC = CASE WHEN (IDENT_CURRENT(@TableName) = 1) THEN 1 ELSE 0 END\r\nDECLARE @Sql NVARCHAR(MAX) = 'DELETE FROM [' + @TableName + ']'\r\nEXECUTE sp_executesql @Sql\r\nIF (@@ERROR = 0) BEGIN\r\nDBCC CHECKIDENT (@TableName, RESEED, @NextId)\r\nCOMMIT TRAN\r\nEND ELSE BEGIN\r\nROLLBACK\r\nEND<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/github.com\/reduardo7\/TableTruncate\" target=\"_blank\">Kaynak:\u00a0Eduardo Cuomo<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>DECLARE @TableName NVARCHAR(128)=&#8217;TabloAdi&#8217; BEGIN TRAN DECLARE @NextId NUMERIC = CASE WHEN (IDENT_CURRENT(@TableName) = 1) THEN 1 ELSE 0 END DECLARE @Sql NVARCHAR(MAX) = &#8216;DELETE FROM [&#8216; + @TableName + &#8216;]&#8217; EXECUTE sp_executesql @Sql IF (@@ERROR = 0) BEGIN DBCC CHECKIDENT (@TableName, RESEED, @NextId) COMMIT TRAN END ELSE BEGIN ROLLBACK END &nbsp; &nbsp; Kaynak:\u00a0Eduardo Cuomo<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[31,30],"class_list":["post-75","post","type-post","status-publish","format-standard","hentry","category-t-sql","tag-foreign-key","tag-truncate-table"],"_links":{"self":[{"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/comments?post=75"}],"version-history":[{"count":4,"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/posts\/75\/revisions"}],"predecessor-version":[{"id":79,"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/posts\/75\/revisions\/79"}],"wp:attachment":[{"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/media?parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/categories?post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/uysalyilmaz.com\/index.php\/wp-json\/wp\/v2\/tags?post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}