Unable to log in to server in SQL Server 2008 R2 Management Studio

I have a SQL Server 2008 R2 instance and can log in using the sa user. But I want to define another user (administrator) to log in with SQL Server Management Studio, so I did the following: Logged in to the server in Management Studio as sa. Right clicked on the database name. Clicked on […]

deleting duplicate row with no unique identifier

I have some data in a table that looks roughly like the following: table stockData ( tickId int not null, timestamp datetime not null, price decimal(18,5) not null ) Neither tickId nor timestamp are unique, however the combination of tickId and timestamp is supposed to be unique. I have some duplicate data in my table, […]

Is there an alternative to joins to increase performance?

Is there an alternative to joins to increase performance? Edit (gbn): related to join-or-correlated-subquery-with-exists-clause-which-one-is-better Why didn’t anyone mention about nested loop joins?

SQL Server – Order by case

I am trying to get the following query to display the results in alphabetical order by City except for the fact that I want “Berlin” to appear at the top of the list So the results would look something like Berlin Algeria Australia Fiji Greece … Hope that makes sense, I currently have the following… […]

No “admin rights” in SQL Management Studio

I’m using SQL Management Studio 2008 Express as a graphic interface to my local SQL Server 2008 Express instance, both of which I have locally only as a test and developement interface for my web projects. I have recently grown more confident in SQL coding, and started to use some more complicated sql stuff – […]

Pyodbc installation error on Ubuntu 16.04 with Sql Server installed

I am trying to test my scripts for data migration from mssql-server to oracle server. For this, I have to install pyodbc python package for Ubuntu, it has the dependency of unixodbc. When I try to install unixodbc-dev using: sudo apt-get install unixodbc-dev It gives broken packages error: The following packages have unmet dependencies: unixodbc-dev […]

primary key duplicate record bypass to next insert

weird question. i am inserting 10,000 records or so in a table and the primary key is not an Identity field. so when inserting all 10,000 if some are duplicate, is there a way to skip to next record in sql server insert and make sure the non-duplicates go in? i really dont care bout […]

How to connect AWS ELB to RDS running MS SQL?

AWS clearly states here and in the Q&A that one can connect to an MS SQL server using a PHP instance on the Elastic Beanstalk. However, there seems to be no way to install the MSSQL drivers. For example, installing yum php-mssql from the ELB command line, generates errors stating that the versions of the […]

optimize for unknown for SQL Server 2005?

I was listening to the SO podcast and they mentioned Optimize For Unknown for SQL server 2008, they also mentioned that there was something similar for SQL Server 2005. Anyone know what this is?

Replace spaces using function in sql

I’am currently developing a program and i want to write a function which is accept a value in following format “AAAA BBBB” CCCC DDDD EEEE “FFFF GGGG HHHH” I want to replace the spaces in above with “_” and need a output as showed following format (please note that this should happen only for string […]

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