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. On SQL Server, you need to use the NEWID function, as illustrated by the following example: SELECT CONCAT(CONCAT(artist, ' - '), title) AS song FROM song ORDER BY NEWID() When running the aforementioned SQL query on SQL Server, we are going to get the following result set:

  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. I would recommend using a BOOLEAN datatype if your database supports this. Otherwise, the best approach is to use NUMBER(1) or equivalent, and put a check constraint on the column that limits valid values to (0,1) and perhaps NULL if you need that.

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

  7. then SQL Server will automatically and safely increase your ID value, and UserID will contain values like UID00000001, UID00000002,..... and so on - automatically, safely, reliably, no duplicates. Update: the column UserID is computed - but it still OF COURSE has a data type , as a quick peek into the Object Explorer reveals:

  8. Whenever you 'see' something in the GUI (SSMS) and you're like "that's what I need", you can always run Sql Profiler to fish for the query that was used. Run Sql Profiler. Attach it to your database of course. Then right click in the GUI (in SSMS) and click "Refresh". And then go see what Profiler "catches".

  9. In Microsoft SQL Server Management Studio, you can also right-click a table and select "Design" to open the design view. From here you are presented with a list of each column in the table, with each column's respective data type listed next to it.

  10. If you rename your Database, MS SQL Server does not rename the underlying files. Following query gives you the current name of the database and the Logical file name (which might be the original name of the Database when it was created) and also corresponding physical file names. Note: Un-comment the last line to see only the actual data files

  11. The short answer is to use two single quotes - '' - in order for an SQL database to store the value as '. Look at using REPLACE to sanitize incoming values: Oracle REPLACE; SQL Server REPLACE; MySQL REPLACE; PostgreSQL REPLACE; You want to check for '''', and replace them if they exist in the string with ''''' in order to escape the lone single ...