T-SQL StartsWith

by robert 28. May 2009 19:26

Schade das der MS-SqlServer von Hause aus nicht syntaktisch schönere Abfragen unterstützt. Insbesondere CAST ist umständlich und Beispielsweise die DATETIME Funktionen weder bequem noch besonders vollständig.

Ich wünsche mir IntelliSense-freundliche Syntax, die Spalten/Projektionen als Objekt auffasst und Typabhängig eine Reihe von Funktionen zulässt:

SELECT * FROM SomeTable
WHERE Name.StartsWith(‘a’)

 

Hier das ganze in gültigem SQL

SELECT * FROM SomeTable
WHERE Name like 'a%'

oder

SELECT * FROM SomeTable
WHERE SUBSTRING(Name, 0, 1 ) = SUBSTRING ( 'a', 0, 1) 
 
 
 

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Oliver

shades-of-orange.com code blog logo I build web applications using ASP.NET and have a passion for javascript. Enjoy MVC 4 and Orchard CMS, and I do TDD whenever I can. I like clean code. Love to spend time with my wife and our children. My profile on Stack Exchange, a network of free, community-driven Q&A sites

About Anton

shades-of-orange.com code blog logo I'm a software developer at teamaton. I code in C# and work with MVC, Orchard, SpecFlow, Coypu and NHibernate. I enjoy beach volleyball, board games and Coke.