This is about a bizarre behaviour I found in Microsoft Sql Server. Please correct me if I’m wrong. SELECT COUNT(*) FROM TABLEA WHERE [Column1] IS NULL; This returns 30018 rows. CREATE VIEW VIEWB …
Tag: sql
How to join the same table twice?
I am stuck on creating a SQL query. I have the following two tables: sender and receiver are foreign keys with table member and column memberid. I want to display list of messages with name and id of sender and receiver. How can I establish proper joins here? Answer You can try something like
SQL alias for SELECT statement
I would like to do something like Is it possible to somehow do the “AS my_select” part (i.e. assign an alias to a SELECT statement)? (Note: This is a theoretical question. I realize that I can do it without assign an alias to a SELECT statement, but I would like to know whether I can do it with th…
Recover sa password [closed]
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 10 years ago. Improve this question I have a computer which was used by another employee. SQL Server 2008 R2 was installed but I don&#…
Oracle copy data to another table
In the Oracle, I copy data from a backup to a new table, it doesn’t work. what is the correct syntax ? Thanks select CODE, MESSAGE into EXCEPTION_CODES (CODE, MESSAGE) from Exception_code_tmp the …
Slow query with where clause
I have following sql query that take only 1 second to execute: But I need a resultset to get the results that has rate greater than 0. So when I change the query to this it takes 7 minutes to execute: Why would this make the query time go up from 1 sec to 7 mins? Since the b table
Retrieving Data from SQL Using pyodbc
I am trying to retrieve data from an SQL server using pyodbc and print it in a table using Python. However, I can only seem to retrieve the column name and the data type and stuff like that, not the actual data values in each row of the column. Basically I am trying to replicate an Excel sheet that retrieves
Connecting to SQL Server Express – What is my server name?
I was just given a laptop to perform some development from a client and I am currently in the process of setting it up. Visual Studio 2010 is installed as well as SQL Server Management Studio 2008 R2. I’m trying to open SQL Server Management Studio to connect to the database but so far am not having muc…
SQL Server 2012 how do I view data?
I have several tables in my database and I am using the SQL Server Management Studio for the first time. I want to see the data. In an SQLite 3 or MySQL I’d simply type SELECT * FROM tblName WHERE… the output would be in my console. Answer In SSMS open a new query window (Ctrl + n), make sure
Pass In “WHERE” parameters to PostgreSQL View?
I have a rather complicated query on my PostgreSQL database spanning 4 tables via a series of nested subqueries. However, despite the slightly tricky looking appearance and setup, ultimately it will return two columns (from the same table, if that helps the situation) based on that matching of two external pa…