Tag: ssms

How to hide security node and logins from some users in SQL?

We are using SQL Server 2012. I’m granting access to some one from out side my company. I hide all Databases except his one. Is there any possible way to hide all users and logins? We want him to have information as few as possible about our server at SSMS. How can we do this?

SQL JOIN doubling values

I have two temp tables with following data: temp_aht temp_1 I use this query to join the two tables on column Incident: Select count(distinct a.Incident) as nr_of_tickets ,a.[Service] ,SUM(CASE WHEN a.status_switch IN (‘Assigned » In Progress’,’Assigned » Pending’,’Assigned » Resolved’,’Assigned » Closed’) THEN a.TotalSeconds ELSE NULL END) AS AssignedTime ,SUM(CASE WHEN a.status_switch IN (‘In Progress […]

Not Nullable fields in SQL Server Still Considered Required Fields in ASP.NET MVC

I have a non nullable fields in a table with default values set already in the property “Default Value or Binding” in SSMS. I linked this table in an ASP.Net mvc application. When I created the view and when running the create view, it still asking me to enter the required fields for the non […]

SQL Server: How to attach / repair a detached / damaged database?

A database server crashed. I was able to get the mdf and the log file and I am trying to mount it on another server. I don’t have backup as it was a development database. When I try to attach the mdf and ldf files, Sql Server Management Studio give me this error: TITLE: Microsoft […]

I can not save my user defined function in my Database in sql server 2012

I am using SQL server 2012. Actually, I am new one in relational database sphere. I create function in my DB but I can’t save it in my Project (current database). How can I save it to my DB and then I need call this function by query? I just press “save” button and sql […]

don`t understand how trigger works

Trigger should react to deleting row from table Suppliers if there is some supplies in the table Supplies from this supplier, trigger should cancel deleting. This code allows to delete both, suppliers with supplies and suppliers without supply: CREATE TRIGGER SuppliersDeleteCondition ON Suppliers FOR DELETE AS IF EXISTS ( SELECT 1 FROM Supplies Ses JOIN […]

invalid parameter 1 specified for datadiff

I want to update field everyday automatically in database about duration. the formula is (due date – date now). I want to use sql server agent. But when I test the job its failed. USE FacilityMonitoring GO UPDATE [dbo].[klaim] SET selisihint = DATEDIFF (“dd”, GETDATE(), durasi_end) GO Query in SQL Server agent: Error:

Connecting to SQL Server Database using a Hosted Web Application

I have created a .net web application using c# that inserts, updates, and deletes data from an SQL server database. I have tested it using my localhost and it works fine. Now I would like to publish this application on a hosted site. My question is, does the database need to be on the same […]

EXEC an INSERT with a dynamic Schema TSQL SSMS

I know that’s a little bit much, but I’m searching for a solution since 4 days. I just want to EXEC a INSERT, but I always get some cryptic Error Messages in SSMS INPUT(variables are wrong so the ErrorLog should get filled): USE [Tfs_GitInterface] GO DECLARE @return_value int EXEC @return_value = [dbo].[spInsertChangeLevel2] @repositoryName = N’asdasd’, […]

When a SQL job starts, what is the value of @@ROWCOUNT?

I have been looking for an answer to this question, but I believe it may be a useful piece of information for others as well. I am working with TSQL in SQL server management studio. Due to the way our system processes information, it’s desirable to do updates in smaller batches. A trick we use […]

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