enow.com Web Search

Search results

  1. Results from the WOW.Com Content Network
  2. Here is an easy and convenient cursor based solution. DECLARE @search_string VARCHAR(100), @table_name SYSNAME, @table_id INT, @column_name SYSNAME, @sql_string VARCHAR(2000) SET @search_string = 'StringtoSearch' DECLARE tables_cur CURSOR FOR SELECT name, object_id FROM sys.objects WHERE type = 'U' OPEN tables_cur FETCH NEXT FROM tables_cur INTO @table_name, @table_id WHILE (@@FETCH_STATUS = 0 ...

  3. I'm looking at creating a basic ORM (purely for fun), and was wondering, is there a way to return the list of tables in a database and also the fields for every table? Using this, I want to be able to loop through the result set (in C#) and then say for each table in the result set, do this (e.g. use reflection to make a class that will do or ...

  4. When a database, not limited to a relational database, has a matrix structured data, it can be borrowed this terminology, but there might be a more specifical one. In relational databases , for example, a table is always a matrix, so at each column in a table corresponds a field in a record and at each row corresponds a record: different ...

  5. This stored procedure will search for table.name and column.name pairs. I use when I have "WhateverId" in code and I want to know where that is (probably) stored in the database without actually having to read through and understand the code.

  6. If you want to export / save all data of a database into a .sql file, do this: Right click on the database in SQL Server Management Studio; Tasks-> Generate Scripts; Script entire database and all database objects; Next; Click - Advanced; Scroll down to Types of data to script and set from Schema only -> Schema and data-> Ok

  7. Changing the name of a SQL database - Stack Overflow

    stackoverflow.com/questions/4080430

    You could Backup the database and then restore, changing the file location during the restore process. using T SQL. ALTER DATABASE databaseName SET OFFLINE GO. ALTER DATABASE databaseNAme MODIFY FILE (NAME =db, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data\db.mdf') GO --if changing log file name

  8. Any of the T-SQL code below will work in SQL Server 2019:-- here, you need to prefix the database name in INFORMATION_SCHEMA.TABLES SELECT TABLE_NAME FROM [MSSQL-TEST].INFORMATION_SCHEMA.TABLES; -- The next 2 ways will require you to point -- to the specific database you want to list the tables USE [MSSQL-TEST]; -- (1) Using sys.tables SELECT * FROM sys.tables; -- (2) Using sysobjects SELECT ...

  9. The naming conventions used in SQL Server's AdventureWorks database demonstrate many best practices in terms of style. To summarize: Object names are easily understood; Table names are not pluralized ("User" table not "Users") Abbreviations are few, but allowed (i.e. Qty, Amt, etc.)

  10. Replace XXXDATABASENAMEXXX with the name of a database. Solution 1. Indexing. Rebuild all indexes for a table in offline mode. ALTER INDEX ALL ON XXXMYTABLEXXX REBUILD Rebuild one specified index for a table in offline mode. ALTER INDEX XXXMYINDEXXXX ON XXXMYTABLEXXX REBUILD Solution 2. Fragmentation

  11. If I want to know the server I can use: @@SERVERNAME Is there an equivalent function for getting database/catalog name. I know that we can set it in the script with USE statement but what if it ...