SQL Cafe

SQL Cafe 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.

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

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

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

Don’t think about AI and Machine Learning as fancy terms!It is happening and if you fail to learn these things I think y...
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 announcements focus on giving customers options, including on-premises, cloud, operating systems, and ML and AI frameworks.

در نسخه هاي پيشين ما به استفاده از زبان R محدود بوديم ولي با اضافه شدن Python  به نسخه ٢٠١٧ اين امكان به يك انتخاب جدي ت...
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.

Official News from Microsoft’s Information Platform

به نظر من براي همه كساني كه با اطلاعات كار ميكنند ضروري هست كه بدونن يادگيري متشين و هوش مصنوعي چطور از اطلاعات استفاده ...
08/11/2017

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

Official News from Microsoft’s Information Platform

بد نيست نگاهي بندازيم به امكانات جديد در نسخه ٢٠١٧مشخصاً ساختار داره تغيير ميكنه به سمت پشتيباني از داده هاي بزرگ و يادگ...
08/11/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...

SSRS 2016
11/04/2016

SSRS 2016

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

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

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

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'

03/03/2013

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

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

Address

Tehran

Website

Alerts

Be the first to know and let us send you an email when SQL Cafe posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Shortcuts

Share

Category