1

I've found that I need to use T-SQL quite frequently (and sometime inventively) at work and I'm trying to take my T-SQL skills to the next level.

I've seen some queries (such as the ones in the stored procedure mentioned here) which allow you to abstract over tables and (potentially, although I'm not sure) other DB objects. Is there a name for queries of this type? Or queries which extend beyond the basics of SQL?

I'm hoping for anything as simple as keywords for research but links and resources would be awesome!

Thanks

Community
  • 1
  • 1
jameselmore
  • 442
  • 9
  • 20
  • 1
    That is not a query. It is a stored procedure, using a cursor. Both are examples of a SQL scripting language, in this case t-sql. The scripting language usually differs more between databases than queries. – Gordon Linoff Dec 10 '14 at 20:55
  • My mistake, I have a grasp on the difference between stored procedures and queries, this is probably just not the best example. I'll update my question to include I'm really only interested in T-SQL – jameselmore Dec 10 '14 at 20:56

1 Answers1

1

When you build a query into a string and the execute that string, this is referred to as dynamic SQL

I'd highly recommend you read the excellent The Curse and Blessings of Dynamic SQL article.

Joe Stefanelli
  • 132,803
  • 19
  • 237
  • 235