SQL exclude all rows that with have certain value?

i have a table with these value, and here is a small sample order state item id 10064315 ON MCM1L162L116 10064315 ON MCM1R162R116 10064315 ON SHIPPING 10064316 MS 00801-1778 10064316 MS SHIPPING 10064317 AZ CHM110439-1 10064317 AZ SHIPPING 10064318 TX 2607 10064318 TX SHIPPING 10064319 MO CHG8080 10064319 MO SHIPPING 10064322 CA W10001130 I want […]

SQL Login and access

I am having trouble with SQL. I installed a fresh version of SQL 2012, On the creation part I assign a user to be Kleber-Pc, accessed couple times fine. However when I tried to access it from my asp.net mvc application using windows credentials, the SQL rejected the connection, so I tried to load SQL […]

Ordering strings that contain numbers

I have a column named MR which is a varchar. When I run a query with an ORDER BY it doesn’t seem to be ordered correctly. select MR, LName, FName from users where MR between ‘MR20001’ and ‘MR20002’ order by MR Results: MR20001 | LINA | MARY MR200011 | TEST | CASE MR20002 | KO […]

Drop a schema using variable name

I have the following: DECLARE @SchemaName NVARCHAR(MAX) SET @SchemaName = ‘MySchema’ DROP SCHEMA MySchema How should I go to use the variable? I tried DROP SCHEMA OBJECT_ID(@SchemaName) Maybe DELETE FROM SYS.SCHEMAS WHERE NAME = @SchemaName equals a DROP?

Syntax error in insert into statement in C# links to MS Access By ADO.NET

Every one i write code that insert some data into Microsoft Access database but i have an error “Syntax error in insert into statement” i don’t know why !!! Any one help me ? thanks in advance ; code: OleDbConnection conn = new OleDbConnection(@”Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\me\Library Store\Library Store\Store.accdb”); try { conn.Open(); OleDbCommand cmd = new OleDbCommand(); […]

To use or not to use identity on a lookup table

In SQL Server I have the following lookup table that holds degree levels: create table dbo.DegreeLevel ( Id int identity not null constraint PK_DegreeLevel_Id primary key clustered (Id), Name nvarchar (80) not null constraint UQ_DegreeLevel_Name unique (Name) ) Should I use identity on the ID? When should I use identity or a simple int in […]

SQL Server Update Fails Based on Another Table?

In SQL Server 2012, I am trying to set the values of my “TradeDate” column equal to the values of my “MARKET_DAY” column. Here is my current code: USE Sales GO update dbo.try1 SET dbo.try1.TradeDate = dbo.yesterday.MARKET_DAY FROM dbo.try1, dbo.yesterday However, when I run this, I get: (0 row(s) affected) and I do not know […]

SQL Exception Error C# ASP.Net

It’s been awhile since I’ve messed with anything SQL, and I’m trying to build a little Todo app to learn some ASP.Net with C#. I’m using Visual Studio 2013 with whatever version of SQL Express it comes packaged with, all locally. I have the following table todo_list, made with the following script, through Visual Studio: […]

DateTime Format set for the SQL Server or per database

Via this code: var ciIL = CultureInfo.CreateSpecificCulture(“he-IL”); var todayNow = DateTime.Now.ToString(“g”, ciIL ); the DateTime will generate in my local preferred format (04/07/2013 20:00) And that is the way I set my windows localization format for date/time and same way I would really like it to be set, in SQL Server (currently I am using […]

Updating table in SQL Server

I am running my query, but it does not work. The cause is the value of column is null and I’m trying to update it with a integer value. This is my query. The default value of sdoc is null update expenese set sdoc = sdoc + ‘200’ where expenese.date = ‘2016-03-26’;

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.