Tag: ssms

How to connect to SQL Server using SQL Server Management Studio using Windows and SQL Authentication

I am new to SQL Server 2012. I have installed SQL Server 2012 on my local machine successfully. When I try to connect to it using Management Studio, I am getting errors. I am not able to connect using Windows Authentication or SQL Server Authentication. I didn’t get any screen asking for username or password […]

Trial column in client statictics SQL

I start attach Client Statistics to examinate my queries. There are “Trial x” columns, What do they mean? I use SQL Server 2014

Create database backup, ignore column

I’d like to create a database backup using SSMS. The backup file will be a .bak file, but I would like to ignore 1 column in a certain table, because this column isn’t necessary, but it takes up 95% of the backup size. The column values should all be replaced by 0x00 (column type is […]

Concat the table records based on the condtion

I am building a SSRS Report to show Student Class Information. I have a table named class with information regarding classes students were attended. My requirement is to show the days in which the classes occur. For eg: If Column Name Monday = ‘Y’ then I have to show the day as [Mon]. I have […]

SQL Server 2012 date and time

I’m trying to create a simple database for a class but when entering time or date variables, I get an error. My code looks a little like this: USE Music INSERT INTO [dbo].[Album] ([Length], ReleaseDate, DateAdded) VALUES (’40:17′, ‘2015/09/18’, ‘2015/10/15 00:00:00.0000’) Then I get the following error: Msg 241, Level 16, State 1, Line 3 […]

Application can open .mdf with no log file but Management Studio can not attach

I installed the DevExpress demo C:\Users\Public\Documents\DevExpress Demos 15.2\DevExtreme\DXHotels The demo came with HotelDB.mdf in the App_Data folder. Out of curiosity I attempted to open the HotelDB.mdf by attempting to attach it using SQL Server 2012 Express Management Studio However I got an error about a missing log file when I did this. When I ran […]

SSMS 2014 – Failed to retrieve data for this request – unknown property IsMemoryOptimized

I get the following error when I try to expand keys for a table using SSMS 2014 on Azure SQL Server (13.0.702). If I use “Script Table as” I can get a working query. Has anyone else experienced this? Error: Microsoft SQL Server Management Studio Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc) ADDITIONAL INFORMATION: […]

SQL Server : column name of max of several columns for each row

I have a table called campaigns that shows the number of ’tiles’ each category is displayed in in an email campaign, like below campaign_id categoryA_tiles categoryB_tiles categoryC_tiles … cateogory Z_tiles 1 5 7 4 … 4 2 4 4 9 … 1 I need to add 3 columns to this table that show the 3 […]

T-SQL – Get runduration from a restore job

I’m using the code below to pull 3 columns: Server Name Database Name Date/Time Restore started Code: WITH LastRestores AS ( SELECT @@SERVERNAME AS [ServerName], [d].[name] AS [DatabaseName], CONVERT(VARCHAR, r.restore_date, 100) AS [RestoreDateTime], RowNum = ROW_NUMBER() OVER (PARTITION BY d.NAME ORDER BY r.[restore_date] DESC) FROM master.sys.databases d LEFT OUTER JOIN msdb.dbo.[restorehistory] r ON r.[destination_database_name] = […]

SSMS Rank() function. How can partition by a range of values rather than an exact value?

I’m using a rank() and a row_number() function in some sql code. Everything is working fine except for parts where I have records that have [np_Exposure_Total] values as 20134446 vs. 20134447. I want these to essentially be treated as if they were the same number. I’m thinking ideally I would like to do it by […]

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