Question : Insert or replace logic for MS SQL

I'm considering replacing a Sqlite3 database with MS SQL, but I want to make sure I'm not going to have problems with converting some of the non standard SQL commands.

In Sqlite3, you can issue an insert or replace command like the following:
INSERT OR REPLACE INTO MembersPreference (key, PreferenceName, PreferenceValue) VALUES ("foo", "foo2", "foo3");

The above command will add the record to the database if the record doesn't exist, or update it if matching key does exist.
Is there similar logic available in MS SQL without having to use procedures?

Also, in Sqlite3 I can limit row results by using limit in the query.
Example:
select name from mytable where group = "foo" limit 0, 100;
The above command will limit the results to the first 100.  Is there similar query command in MS SQL?

Answer : Insert or replace logic for MS SQL

SQL Server does not have an INSERT OR REPLACE INTO or replace command.

This would have to be don with a procedure.

However it does have similar funcionality to this command:

select name from mytable where group = "foo" limit 0, 100;

SQL Server has a TOP keyword to use with SELECT, such as

Select TOP 100 from mytable where group = 'foo'
Random Solutions  
 
programming4us programming4us