SQL Cafe

SQL Cafe

Share

This page is created by Roxana Rezaei and Sasan Ahmadi who have extensive experience working with MSSql. We are looking for people who are interested in SQL.

Here we want to discuss how you can have fun while you are working with SQL. You are more than welcome in sharing your experiences, ideas, knowledge, etc. Please feel free to do so.

The State of Structured Query Language (SQL) in 2019 — Dice Insights 11/02/2019

It is interesting to see the language has survived a lot since so long and it appears to rock for more 😊

The State of Structured Query Language (SQL) in 2019 — Dice Insights In 1974, Abba won the Eurovision song contest with “Waterloo.” That same year saw the birth of Structured Query Language (SQL). Created as a standardized

Microsoft Ignite 2017: It's all about choice, from SQL Server 2017 to Azure Machine Learning | ZDNet 13/11/2017

Don’t think about AI and Machine Learning as fancy terms!
It is happening and if you fail to learn these things I think you will fall behind evolution!

Microsoft Ignite 2017: It's all about choice, from SQL Server 2017 to Azure Machine Learning | ZDNet ​Microsoft Ignite announcements focus on giving customers options, including on-premises, cloud, operating systems, and ML and AI frameworks.

Python in SQL Server 2017: enhanced in-database machine learning 09/11/2017

در نسخه هاي پيشين ما به استفاده از زبان R محدود بوديم ولي با اضافه شدن Python به نسخه ٢٠١٧ اين امكان به يك انتخاب جدي تبديل شده و ميشه از همه پكيج ها و امكاناتي كه در زبان براي ديتا ساينتيست ها هست استفاده كرد.

In previous versions of SqlServer it was identical to R as only data scientist option to work inside sqlserver, but the addition of Python make it a real choice becuase of vast number of data scientists and packages for this popular language.

Python in SQL Server 2017: enhanced in-database machine learning Official News from Microsoft’s Information Platform

In-database Machine Learning in SQL Server 2017 08/11/2017

به نظر من براي همه كساني كه با اطلاعات كار ميكنند ضروري هست كه بدونن يادگيري متشين و هوش مصنوعي چطور از اطلاعات استفاده ميكنه، در نسخه جديد ٢٠١٧ امكانات زيادي براي اين منظور هستش

In-database Machine Learning in SQL Server 2017 Official News from Microsoft’s Information Platform

What's new in SQL Server 2017 08/11/2017

بد نيست نگاهي بندازيم به امكانات جديد در نسخه ٢٠١٧
مشخصاً ساختار داره تغيير ميكنه به سمت پشتيباني از داده هاي بزرگ و
يادگيري ماشين

What's new in SQL Server 2017 SQL Server 2017 represents a major step towards making SQL Server a platform that gives you choices of development languages, data types, on-premises or cloud, and operating systems by bringing the power of SQL Server to Linux, Linux-based Docker containers, and Windows. This topic summarizes what i...

Top 3 Reasons to Upgrade to SQL Server 2016 Reporting Services 11/04/2016

SSRS 2016

Top 3 Reasons to Upgrade to SQL Server 2016 Reporting Services Heavy users of SQL Server Reporting Services (SSRS) haven’t had much incentive to upgrade since the 2008 R2 rollout – until now.

18/09/2013

در ادامه پست روز قبل حالا 2 دستور زیر رادر SQL 2012 اجرا کنید

SELECT PARSE('10.20' AS INT) AS [Using PARSE Function]
GO
SELECT TRY_PARSE('10.20' AS INT) AS [Using TRY_PARSE Function]
GO
اینبار نتیجه استفاده از تابع Parseبا پیغام زیر خواهد بود
Error converting string value '10.20' into data type int using culture ''.
چون '10.20' معادل Integerنیست
ونتیجه اجرا برای تابع TRY_PARSE خروجی NULLخواهد بودو نه خطا
اگر مایلید بیشتر دراین زمینه بدونید، لینک زیر رو دنبال کنید
http://technet.microsoft.com/en-us/library/hh213126.aspx

TRY_PARSE (Transact-SQL) Returns the result of an expression, translated to the requested data type, or null if the cast fails in SQL Server 2012. Use TRY_PARSE only for converting from string to date/time and number types.

17/09/2013

این 3 تا دستوررو در SQL 2012 اجرا کنید
SELECT CAST('Saturday, 18 February 2012' AS datetime2) AS [Using CAST Function]
GO
SELECT CONVERT(datetime2, 'Saturday, 18 February 2012') AS [Using CONVERT Function]
GO
SELECT PARSE('Saturday, 18 February 2012' AS datetime USING 'en-GB') AS [Using PARSE Function]
GO
خواهید دید که فقط دستور PARSE قابلیت تبدیل این نوع Stringها رو به فرمت datetime داره.PARSE درنسخه 2012 به SQLاضافه شده.فقط یادتون باشه که اگرNullرو بعنوان ورودی به این تابع بدید همون Nullرو بعنوان نتیجه دریافت میکنید.
اگر مایلید بیشتر دراین زمینه بدونید، لینک زیر رو دنبال کنید
http://technet.microsoft.com/en-us/library/hh213316.aspx

PARSE (Transact-SQL) If the culture argument is not provided, then the language of the current session is used. This language is set either implicitly, or explicitly by using the SET LANGUAGE statement. culture accepts any culture supported by the .NET Framework; it is not limited to the languages explicitly supported b...

16/09/2013

تابع FORMAT یکی از توابعی هست که ازنسخه 2012 به SQLاضافه شده و همونطو که از اسمش معلومه میتونه داده ورودی رو با فرمت مورد نظرتون برگردونه .خروجیش بصورت Nvarcharیا Nullهست و بهتره برای فرمت های مختلف روی Date/Time یا Integerاستفاده بشه.در مواقع معمولی CastویاConvertکارمون رو راه میندازن.لینک زیر رو برای اطلاعات بیشتر دنبال کنید
http://technet.microsoft.com/en-us/library/hh213505.aspx

FORMAT (Transact-SQL) Returns a value formatted with the specified format and optional culture in SQL Server 2012. Use the FORMAT function for locale-aware formatting of date/time and number values as strings. For general data type conversions, use CAST or CONVERT.

13/04/2013

این اسکریپت به شما کمک می کند که اسکریپت ساختن Index بر روی تمام ForeignKey ها را بسازید.

SELECT DISTINCT
'CREATE NONCLUSTERED INDEX IX_' + KEY_COLUMN_USAGE.TABLE_NAME + '_' + KEY_COLUMN_USAGE.COLUMN_NAME + '_' + CAST(ROW_NUMBER() OVER (ORDER BY KEY_COLUMN_USAGE.TABLE_NAME, KEY_COLUMN_USAGE.COLUMN_NAME) AS NVARCHAR(10)) + ' ON ' + KEY_COLUMN_USAGE.TABLE_SCHEMA + '.' + KEY_COLUMN_USAGE.TABLE_NAME + '( ' + KEY_COLUMN_USAGE.COLUMN_NAME + ' ASC )'

FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS

JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE ON TABLE_CONSTRAINTS.CONSTRAINT_NAME = KEY_COLUMN_USAGE.CONSTRAINT_NAME AND TABLE_CONSTRAINTS.TABLE_NAME = KEY_COLUMN_USAGE.TABLE_NAME

WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'

07/04/2013

شاید این آدرس برای دوستان مفید باشه
http://blogs.msdn.com/b/microsoft_press/archive/2012/05/04/free-ebooks-great-content-from-microsoft-press-that-won-t-cost-you-a-penny.aspx

Free ebooks: Great content from Microsoft Press that won’t cost you a penny - Microsoft Press - Site MICROSOFT PRESS publishes on Microsoft tools & technologies, plus programming best practices. Our blog offers book info, links to ebooks, & other good stuff. Enjoy!

03/03/2013

تا قبل از Sqlserver2008با دستور INSERT INTO فقط میتوانستیم یک رکورد درجدول اضافه کنیم ولی از این ورژن به بعد با استفاده از این دستوربصورت زیر قادر به اضافه کردن چندین رکورد در یک دستور خواهیم بود:

INSERT INTO [dbo].[Table_1]
([s1]
,[s2]
)
VALUES
('1'
,'2'
)
, ('11'
,'21'
),
('111'
,'211'
)
GO

Want your school to be the top-listed School/college in Tehran?
Click here to claim your Sponsored Listing.

Category

Website

Address


Tehran