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. 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

  5. This version allows you to have it in an administrative database and then search through any database. Change the decleration of @db from 'master' to whichever you want the default database to be (NOTE: using the CONCAT() function will only work with 2012+ unless you change the string concatenation to use the + operators).

  6. 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 ...

  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. This should be the top answer, IMHO. The ability to filter on different datatypes is great. The only gripe I have about it, is that the GUI for selecting/de-selecting "what tables to search in" is a checkbox-list with NO check/uncheck-ALL option or multi-select-and-toggle ability.

  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. 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 ...

  11. One possible problem is that you have two instances of the database, so you have to deactivate one instance, if you have your database opened and accessible in your server explorer in Visual studio close connexion then go to windows services and stop and restart SQL server service (MSSQL) then go to Management studio and open your database, it should be opened and you can explore tables from ...