I'm using SqlServer 2005 and I have a column that I named.
The query is something like:
SELECT id, CASE WHEN <snip extensive column definition> END AS myAlias
FROM myTable
WHERE myAlias IS NOT NULL
However, this gives me the error:
"Invalid column name 'myAlias'."
Is there a way to get around this? In the past I've included the...
I'm new to JOINS in MySql.
I have six tables: t1, t2, t3, t4, t5, t6.
And I also have one main table: main_table.
TOTAL 7 TABLES!
The first column of ALL tables is called classified_id.
If the user searches for "cars" then the main table will match everything in table t1 (which is the cars table) where classified_id is the same in bot...
I'm trying to make a little site for few people. Basically what i'm looking for is that users can register to this site, log on and upload files. I want the files to upload to a new folder that is named after the uID for example.
User Tommy registers and get user id 1234.
Then his upload folder will be
http://www.site.com/users/1234/up...
Hi,
I have to move a database from sql server to mySql, and our current db uses schemas as namespace.
So all of the FOO tables can be reference like FOO.TableFoo1, FOO.TAbleFoo2, FOO.TableF003, etc.
Can we do this with MySql? Will it work.
...
I need to update the SQL SERVER stored procedure on three different servers. I do not like to perform this manually. What are my options?
...
What does it mean by footprints in SQL Server?
here's a snippet from MSDN "reduce the lock footprint of expensive queries" LINK
...
I have this string that i am getting from .net application
A,B,C,D,E,F,
I wanted to write a sql select statement like
set @string = 'A,B,C,D,E,F'
select * from tbl_test
where tbl_test.code in (@string)
This wont work in t-SQL because it is using the @string as one string it is not separating the values. Is there any ways i can do ...
I'm creating the database for monitoring status of applications' functionalities. The logic is following:
Each application has its own, specific list of functionalities that I'm monitoring. Each functionality belongs to only one application. There is a Functionality table that has foreign key to Application
Each application runs on one...
My application has a table that contains snapshot inventory data from each year. For example, there's a vehicle inventory table with the typical columns vehicle_id, vehicle_plate_num, vehicle_year, vehicle_make, etc, but also the year designating that the vehicle is owned.
Querying the entire table might result in something like this:
...
The query:
UPDATE
node as n
right join content_type_product as c
on n.nid = c.nid
right join uc_products as p
on p.nid = n.nid
set
c.field_product_price_eur_value = p.sell_price * 0.0961,
c.field_product_price_zar_value = p.sell_price * 1,
c.field_product_price_gbp_value = p.sell_pric...
I have a table that functions as an event log and stores the users signed in state, 'In', 'Out', or 'Rejected' (sometimes users my be 'Rejected' based on external criteria).
Here is some sample data so you can get an idea of what the table looks like:
Table MyTable
PersonID - State - DateTime
// data sample
156 - 'Out' ...
I have developed a web application and various clients can store records to that database simultaneously.
I have set the auto-primary-key generation functionality of that database that generates a primarykey automatically (auto-increement) whenever a new record is added to the database.
So my question is Can I rely on this auto-key-gen...
I'm noticing short URL sites are using alphnumeric id instead of integers for unqiue id.
Have anybody have experience with implementation? What is the best way to implement this feature in MySQL? I believe the tricky part would probably be the incrementation and indexing of the id.
example: bit.ly/AbC123
...
I'm trying to write a named scope that will order my 'Products' class based on the average 'Review' value. The basic model looks like this
Product < ActiveRecord::Base
has_many :reviews
Review < ActiveRecord::Base
belongs_to :product
# integer value
I've defined the following named scope on Product:
named_scope :best_reviews, ...
I have been experimenting with writing applications that use a local SQL Database to store data. I am using Visual Studio to create Windows Forms applications and then connecting them to a database and using LINQ to SQL to pass data to and from the DB. My question is, when I deploy this program on a target machine, what requirements must...
I'd like to write a procedure with cursor, which will thirl patient to first free doctor (who don't have any visit at this time, but I don't know what would be easier
to declare hour like 'IN' in procedure and then find a free doctor at this time
or to find a free doctor from this time to the close of medical centre knowing that one v...
Whenever I want to add a column to a table it usually goes something like this:
Fire up SQL Server Management Studio (SSMS)
Select "Design" on the table I want to add the column to
Add the new column to the table
Save
Get an error that SSMS can't save because it would need to drop the table (and it can't because the the table has forei...
I have an application that keeps track of prices for various products. Prices might change for any given product at any time during any day, and will not change regularly. There is a PriceHistory table that has dated records for all of the prices for the products over time. Users of the application can select a time and date and see what...
Hello,
I have a list of 9 user id's and want to select 3 entries per user id.
My current query looks like this.
SELECT * FROM entries WHERE user_id IN (1,2,3,4,5,6,7,8,9) LIMIT 27
Some users have many more than 3 entries, so I want to limit the results of this query to 3 entries per user.
I tried making a UNION of 9 separate querie...
For Postgres is there any sort of command line utilities that allow a database to be "dumped to a file" and that allow that same database dump to be imported?
I know this can be done through PGAdmin, but I need to be able to do this on the cmd line.
...