All true, and if one wanted to fully emulate an enum one would also need an extra column for the integer value.
But you can't add new members to an enumeration without recompiling either.
Anyway, I got the impression that the OP only wanted to limit the items in a column, and if your objections is of no concern for the OPs intended usage, this is a simple way to achieve a limited list of items.
"The ones who care enough to do it right care too much to compromise."
Which is likely true, but I hope to open his eyes to a broader solution that he may not have considered yet.
Reducing record size may not be as important with today's databases and storage availability, but it's still better to store a foreign key rather than a string, particularly if you may need to select records with given values.
Having a table with the keys and values also allows for easier loading of a list from which the user can select items.
Like many time my answers are got down voted. If anyone will give the comments then down voted means we will improve our answering way. Simply without any mistakes and reasons giving down vote then it will spoiled our Interest in Code Project. So please take some action in this Issue.
hi to all
ho can i get top 1 from my table.
i have a event log table that 3 event inserted in it i want to get top 1 each event by desc in it .
my code is but this code is wrong and correct code probably similar to this code
SELECT [Guid] ,
WHERE ( [Guid] = ( SELECTTOP ( 1 )
FROM EventLogs AS elog
WHERE ( ReferenceGuid = EventLogs.ReferenceGuid )
Long story short, what do you folks use to update a database in unison with a given software release? We have a 10+ year old in house tool that's ending it's life (SQL Server is ending SQL-DMO support). This is a company-written tool to move a DB from Version N to N.N in unison with a software release.
Do you guys write your own, or what links can you send me? I've been playing with RedGate's SQL Source Control, but our DB is big enough that it chokes on it. Small DBs seem to fly, but ours is a big, multi-year multi-product suite type of db.
Apex? What do you use or do you build your own? Ten years is a nice life cycle for this product so if we write one that's good for another ten, okay. I'd rather buy one first.
thanks for the input.
Think of how stupid the average person is, and realize half of them are stupider than that. - George Carlin
Backup/restore on a new server, I'm pretty sure you can restore an older version into a current database. Not sure if the version range is too wide though. Unless you have a pressing need to update the code in your database.
Never underestimate the power of human stupidity
Hi i created a web service in PHP using mysql now i wan to change the same into SQL is there any option.
-- phpMyAdmin SQL Dump
-- version 22.214.171.124
-- Host: localhost
-- Generation Time: Mar 21, 2013 at 11:46 AM
-- Server version: 5.5.16
-- PHP Version: 5.2.9
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
CREATE TABLE IF NOT EXISTS `user_details` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`First_Name` varchar(255) NOT NULL,
`Last_Name` varchar(255) NOT NULL,
`Middle_Name` varchar(255) NOT NULL,
`Door` varchar(255) NOT NULL,
`Street` varchar(255) NOT NULL,
`Building` varchar(255) NOT NULL,
`Area` varchar(255) NOT NULL,
`Theil` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Aren't there any tools for migrating the data from MySQL to Microsoft SQL Server? That would be the easiest thing.
You cannot just load the backup from MySQL into SQL Server: all table/column names are escaped with ` - SQL Server uses . E.g. `user_details` => [user_details]. If the name does not contain spaces or is a reserved word, you could remove the quotes.
And before loading the data into the table, you must do a SET IDENTITY_INSERT [user_details] ON (and switch it off afterwards).
I'd also suggest to change the varchar into nvarchar: that safely allows for national characters.
Last Visit: 28-Feb-20 20:56 Last Update: 28-Feb-20 20:56