About 4,420,000 results
Open links in new tab
  1. Is there a way to retrieve the view definition from a SQL Server …

    Which version of SQL Server? For SQL Server 2005 and later, you can obtain the SQL script used to create the view like this: select definition from sys.objects o join sys.sql_modules m on m.object_id = o.object_id where o.object_id = object_id( 'dbo.MyView') and o.type = 'V'

  2. T-SQL query to show table definition? - Stack Overflow

    Jun 2, 2011 · Since SQL 2012 you can run the following statement: Exec sp_describe_first_result_set @tsql= N'Select * from <yourtable>' If you enter a complex select statement (joins, subselects, etc), it will give you the definition of the result set.

  3. SQL Column definition: default value and not null redundant?

    May 17, 2017 · Alternatively, you can also use DEFAULT in UPDATE statements, according to the SQL-1992 standard:-- 5. This will update 'MyDefault' into tbl.col UPDATE tbl SET col = DEFAULT; -- 6. This will update NULL into tbl.col UPDATE tbl SET col = NULL; Note, not all databases support all of these SQL standard syntaxes.

  4. How to get the query of a VIEW on SQL Server - Stack Overflow

    Jun 28, 2021 · Microsoft lists 3 different ways to get the definition of a view in SQL Server (also see this StackOverflow question), f.e. SELECT definition FROM sys.sql_modules WHERE object_id = OBJECT_ID('MY.TEST_VIEW'); But they all include CREATE VIEW in the output (which is usually fine) and I need the exact query, i.e. for

  5. indexing - What is an index in SQL? - Stack Overflow

    Jun 2, 2010 · In SQL Server, a clustered index determines the physical order of data in a table. There can be only one clustered index per table (the clustered index IS the table). All other indexes on a table are termed non-clustered. SQL Server Index Basics. SQL Server Indexes: The Basics. SQL Server Indexes. Index Basics. Index (wiki)

  6. Where is the definition of the view stored in SQL Server

    Feb 17, 2018 · When a view is created, information about the view is stored in the following catalog views: sys.views, sys.columns, and sys.sql_expression_dependencies. The text of the CREATE VIEW statement is stored in the sys.sql_modules catalog view. Now to answer your questions: How does SQL Server store this compilation?

  7. What is the definition of cardinality in SQL - Stack Overflow

    Aug 28, 2014 · The Wikipedia entry is more practical. It encompasses the textbook definition, assuming the table has a primary key (the cardinality of the primary key is the same as the table). However, it can be applied to, say, a flag column as well. If the flag only takes on two values (0 versus 1), then we can say that the cardinality of the column is 2.

  8. How to view a stored function - SQL Server - Stack Overflow

    Mar 20, 2013 · You can use sp_helptext command to view the definition. It simply does. Displays the definition of a user-defined rule, default, unencrypted Transact-SQL stored procedure, user-defined Transact-SQL function, trigger, computed column, CHECK constraint, view, or system object such as a system stored procedure. E.g; EXEC sp_helptext ...

  9. Query the contents of stored procedures on SQL Server

    Mar 15, 2015 · This query will retrieve the textual definition of stored procedures and filter using a simple wildcard. For 2000 (untested, but IIRC it's the right table):

  10. What does the term "Tuple" Mean in Relational Databases?

    Apr 15, 2009 · If this is a subject that interests you, I'd highly recommend reading SQL and Relational Theory: How to Write Accurate SQL Code by CJ Date. * Note that I'm talking about tuples as they exist in the relational model, which is a bit different from mathematics in general. **And just in case you're wondering, just about everything in SQL is a row ...