Tag: ssms

Sql Server Management Studio 2012 tries to convert nvarchar to datetime during import

I am publishing an ASP.NET MVC 5 solution from my development box to my hosting provider. I have been using entity framework with localdb v11.0 on my dev box. My hosting provider provides a SQL Server 10.0 database. I am attempting to move my entire localdb to a SQL Server 10.0 db at my hosting […]

How do I change column positions in temporary table while it shows wildcard

I have a table with multiple columns, and when I run it, it shows the wildcard *. Usually to change the column positions I’d go to design query in editor as I’m using SQL Server Management Studio. However it doesn’t allow me to move the columns up and down, as all it shows is wildcard […]

Combining Row Info in DataBase

I’m currently working on a query that I need to combine some info for Below is the query that I have so far SELECT DISTINCT s.SiteID, s.GroupID, sa.StartDateTime, u.UserFirstName + SPACE(1) + UserLastName ScanName, CONVERT(VARCHAR,sa.StartDateTime,101) ApptStartDate, CONVERT(VARCHAR,sa.EndDateTime,101) ApptEndDate, CONVERT(VARCHAR(15),CAST(sa.StartDateTime AS TIME),100) ApptStartTime, saa.Time ArrivalTime, sl.Address, st.StateShortCode, ct.CityName, CASE saa.CheckInCallType WHEN 1 THEN ‘Inbound’ WHEN 2 […]

DATEDIFF to only include working days?

This question already has an answer here: get DATEDIFF excluding weekends using sql server 5 answers

Automating Export of MS SQL Table with a binary column (750,000 character length)

This may or may not be possible. I know sqlcmd could be used to export tables from MS SQL to a csv but my column gets truncated at ~ 65,000 characters. Is there a way to automate the process of exporting a table from MS SQL which has strings with length upto 750,000 (binary data). […]

How to return . in SQL MS results to grid

Say I am querying multiple tables like so SELECT T1.*, T2.* FROM T1 INNER JOIN T2 … etc. In SQL Server Management Studio, I want the results to show in the grid with the table names prepended to the column names What I get by default is this: ID | A1 | … | ID […]

Linq to SQL Where clause returns records that do not match, only when “Edit Top 200 Rows” is used in SSMS?

I’m having issues wording this question, as the title will probably show you, and for that I apologize. First, here’s a screen of the issue. That If clause there was an attempt at fixing this, but it didn’t help. Every 500ms, the program will run this code to find work that needs to be done. […]

Could someone have made changes in the SQL database schema without being tracked (SQL Server 2008 with SQL Server Management Studio)?

I’m using the Entity Framework 6 to manage the access to our database, and I have now been told that some data is missing in the way I’m displaying it. It was said that the respective column(s) has always been in the database and that I or the EF must have failed to load it […]

How to run a tabular function multiple times (with different arguments each time)

I have a tabular function where I’d like to pull the following: select LastName, FirstName, Location, Sales from fnGetStuff (DateID) and I’d like to run it multiple times for a bunch of DateIDs, say (2001, 2004, 2005, 2011) Is there a way to get the tabular function to run multiple times with each of the […]

How to optimize a cycle in stored procedure

I have this stored procedure in T-SQL for splitting a DATETIME into shifts. I would divide the DATETIME START and DATETIME END into shifts (for example, one shift for hours or one shift every 15 minutes). I should this shift into a temporary table for use it in another query. So for this I have […]

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