Data Input asp.net C# SQL

Hey guys I am using a connection string database set-up inside visual studios 2012. I am trying to send data to the database there are no errors in the code but its not running, any help would be fantastic as i have been at it for a few hours now and need some sleep. Thanks. […]

How do I clone an entity that has a client-generated GUID as its ID? (Model-first)

I am trying to clone a database record in the entity framework, but I am wondering how to account for ID fields in the object graph that are GUIDS which are not generated by SQL server. I have tried a method I found here on stack overflow but the ID’s were integers and didn’t fit […]

SQL Server – user permissions/securables change report

Is there a default report in Sql Server that will output the permissions/securables history for given user or login? If not, does anyone know how to craft such a query? We had an incident recently where a user mysteriously lost insert permissions on a table, and we’d like to find out exactly what caused it.

SQL Combine two tables in a View

I have three tables (simplified table diagram above). From these three tables I would like to create a view that would be the combination of TableA and TableB (all rows from tableA and all from TableB with no duplicates). The catch is I don’t want the foriegn keys from TableA but instead I want the […]

Sync stored procedures with software updates

I develop a software system that runs on multiple computers that connect to a centralized database. At this point in time, all SQL queries are inline with the applications source code. I would like to start migrating these into stored procedures. If I need to make a change to a stored procedure that will require […]

T-SQL Contains not working for values with point as 2nd or 3rd symbol

There is a SQL statement, generated by stored procedure, looking like this: SELECT Id, Name FROM UInstitutions as UI WHERE Contains(UI.Name, @ParamName) It seems that if value has dot (.) as second or third symbol, it’s unsearchable, when searching by exact match or substring. E.g.: [dbo].[FindRecords] N’b.la bla’ or [dbo].[FindRecords] N’bl.a bla’ return nothing, while […]

Infinite optional parameters

In essence, I’d like the ability to create a scalar function which accepts a variable number of parameters and concatenates them together to return a single VARCHAR. In other words, I want the ability to create a fold over an uncertain number of variables and return the result of the fold as a VARCHAR, similar […]

Retrieve only distinct combinations

I’m having column as Node varchar(25) in MS-SQL Server. The possible values are node —– D-C C-B B-A B-C B-E C-A A-B A-C C-D etc. I want to retrieve the the distinct combinations from it. E.g.: node —- D-C C-B B-A B-E C-A Please tell the SQL for this.

SQL literal row numbers

Anyone know of an easy way to label rows with a literal label ie 1 | first | data 2 | second| data 3 | third | data 4 | fourth| data 5 | fifth | data Other then using a conditional ordinal. Thanks

Finding duplicate values in a table with a twist

I have a data file that has many duplicate values. I want both the original and the duplicate values to be identified and original and duplicate values to be ordered side by side. My Data files headings are like this along with the data: I want the data to be like this: I have already […]

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