For Email addresses, how much space should I give the columns in SQL Server. I found this definition on Wikipedia: http://en.wikipedia.org/wiki/Email_address The format of email addresses is local-part@domain where the local-part may be up to 64 characters long and the domain name may have a maximum of 253 ch…
How do I use a function result as my alias?
I am wondering if it is possible to use an SQL function to name the column of a query. As a simple example: should theoretically return If we can, which databases would this be available for? If not, then why? Answer AFAIK, there is no SQL way in any major DBMS product to support this. To name PIVOT columns i…
connecting sqlalchemy to MSAccess
How can I connect to MS Access with SQLAlchemy? In their website, it says connection string is access+pyodbc. Does that mean that I need to have pyodbc for the connection? Since I am a newbie, please …
How can I perform a SQL ‘NOT IN’ query faster?
I have a table (EMAIL) of email addresses: EmailAddress ———— jack@aol.com jill@aol.com tom@aol.com bill@aol.lcom and a table (BLACKLIST) of blacklisted email addresses: EmailAddress ——–…
How to count number of records per day?
I have a table in a with the following structure: I would like to know how I can count the number of records per day, for the last 7 days in SQL and then return this as an integer. At present I have the following SQL query written: However this only returns all entries for the past 7 days. How
Creating text file without using bcp in sql
I have to query a table and print the output in a text file. I have a normal user login with dbo permission on the database. I cannot use bcp or cannot give any special permissions. Can anyone help me with this? Answer You can’t create a text file on the server or elsewhere with only permissions in the …
Best way to create a temp table with same columns and type as a permanent table
I need to create a temp table with same columns and type as a permanent table. What is the best way to do it? (The Permanent table has over 100 columns) i.e. Usually I create table like this. …
Android – sqlite in clause using values from array
I want to execute a sqlite query: The values in the in clause need to be taken from an array of strings: How can I achieve that? Answer I believe a simple toString() will mostly do the trick:
Index for nullable column
I have an index on a nullable column and I want to select all it’s values like this: In the explain plan I see a FULL TABLE SCAN (even a hint didn’t help) Does use the index… I googled and found out there are no null entries in indexes, thus the first query can’t use the index. My ques…
insert into values with where clause
I am trying to programmatically enter values into my table. I cannot use a straight Select @variables. I have to use the keyword Values. How can I create a where clause when using Values in the insert into. I am trying to avoid duplicates Answer