Tag: ssms

how to set multiple auto connection in sql server management studio 2014

I have 5 SQL server DB engine in 5 diffrente server like as “10.255.133.51 & 10.255.133.48 & …..” I want to set auto connection for these servers and when i open SQL server management studio in my PC they ready to use without needs to make connection Is there any way to do this ?????

SQL Server Management Studio is not allowing me to Alter views or stored procedures

I am installed Microsoft SQL Server Management Studio 2016 of a new PC that I have. When I try to alter a view I get the following error Syntax error in TextHeader of View ‘ViewName`. Microsoft.SqlServer.Smo) I get this error when I right click on the View > Script View As > Alter to > […]

Connect to multiple DB's from different servers

I have multiple DB’s on different servers and I want to take some information from a table (for example User- this table is on all DB’s). So I add all servers and DB’s on a cursor and then I run this script: BEGIN fetch next from CursorData into @DBName,@DBServer set @cmd=’:Connect ‘ + @DBServer+ CHAR(10) […]

Why is on delete cascade impossible for nullable columns?

I was trying to create a table via SSMS 11.0.6020.0 using SQL Server, via the table designer. I have defined the primary key, the columns and foreign keys. All was well, but when I have hit Ctrl+s to save the script, I received an error message stating that On Delete Cascade may cause cycles and […]

SSMS (MS SQL Server Management Studio) save job into comma delimited csv

I am really new in MS SQL Server Management. I create job.. Then I choose advanced in job steps..and choose to save as test.csv. SELECT T0.U_Scid as ‘id’, T3.U_Boarding as ‘start’, … T3.U_Boarding as ‘end’, T2.Name as ‘service_classification’, T5.U_Type as ‘equipment’ FROM [XXX].[dbo].[@COR_SC_EQUIP] T5,[XXX].[dbo].[@COR_SC_GENERAL] T3, [XXX].[dbo].[@COR_SC_HEADER] T0 INNER JOIN [XXX].[dbo].[OSCS] T1 on T0.U_Status = T1.statusID […]

Select Distinct with Sum

There is an employee table with an entry reordered per person per day. I created this query and it works, but instead of the total hours worked this past week, it should be the sum of the total hours the employee has since the beginning of time. Would someone be able to help? I am […]

How to run a script for each table and save the result into separate CSV files in SSMS 2014?

I have an SQL script that outputs these, given a table name: the column names in the table the datatypes for those columns the column allows NULL or not the column has unique constraint or not. Like this: column | datatype | nullable | unique ————————————– | | | | | | | | | […]

Can't login to SQL Server using SQL Instance Name

I am new in SQL. I have installed SQL Sever 2016 & SSMS2016. My SQL server instance name is MSSQLSERVER (found it in Services list). When I am trying this servername RITWICK\MSSQLSERVER , it’s showing me incorrect. But when I use just RITWICK, no problem.

Write query to export database to csv file via Microsoft SQL Server Management Studio

I am trying to write a query that will export the data from a table into a csv file. I cannot use the manual methods of right clicking the results and selecting save as. It has to be via query. I turned on the SQLCMD mode on my Managment Studio and am trying to run […]

Counting consecutive days of absence greater than 60 days

I have this table called SickLeaves with Employee ID, the start and the end date of the sick leave. EmpID DateFrom DateTo 3022 10.10.2010 13.10.2010 3022 09.11.2011 10.11.2011 3022 11.11.2011 11.11.2011 3022 13.11.2011 17.11.2011 3574 01.11.2011 14.11.2011 3574 15.11.2011 26.11.2011 3908 09.11.2011 09.11.2011 2734 09.11.2011 09.11.2011 3054 16.11.2011 16.11.2011 3054 17.11.2011 17.11.2011 3054 18.11.2011 18.11.2011 […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.