How can I search all columns of a table in SQL Server?
I have some data that includes a column with delimited data. There are multiple records in the same column essentially: A0434168.A2367943.A18456972.A0135374.A0080362.A0084546.A0100991.A0064071.A0100858 The values are of variable length, and delimited by periods. I’ve been attempting to create a lookup table for this data, using a cursor. Due to the volume of data, the cursor is unreasonably […]
I need my select to have a pattern like this: SELECT ‘<text> ‘ + tbl.* + ‘ </text>’ FROM table tbl; The ideal solution would have all the columns separated by a comma in order to have that output: SQL result for Table 1 with two columns: ‘<text>col1, col2</text>’ SQL result for Table 2 with […]
for SQL Server 2008 R2 I have a resultset that looks like this (note [price] is numeric, NULL below represents a NULL value, the result set is ordered by product_id and timestamp) product timestamp price ——- —————- —– 5678 2008-01-01 12:00 12.34 5678 2008-01-01 12:01 NULL 5678 2008-01-01 12:02 NULL 5678 2008-01-01 12:03 23.45 5678 […]
Currently, my database is in Single User mode. When I try to expand me database, I get an error: The database ‘my_db’ is not accessible.(ObjectExplorer) Also, when I try to delete the database, I get the error: Changes to the state or options of database ‘my_db’ cannot be made at this time. The database is […]
I’m aware of this topic ( Find a specific column in an unknown table in a database? ) and my problem is quite similar. The query I need is quite similar to this one (I think): SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE column_name LIKE ‘%watcher%’ But what I need is a query […]
Is there a GUI tool out there that will allow me to migrate entire SQL Server 2008 R2 databases to MySQL? I have MySQL Workbench installed, but it looks like there isn’t a feature in it like SSIS to copy and paste entire databases from SQL Server. I downloaded the MySQL Migration Toolkit, but it […]
I’m trying to remove white spaces from a string in SQL but LTRIM and RTRIM functions don’t seem to work? Column: [ProductAlternateKey] [nvarchar](25) COLLATE Latin1_General_CS_AS NULL Query: select REPLACE(ProductAlternateKey, ‘ ‘, ‘@’), LEN(ProductAlternateKey), LTRIM(RTRIM(ProductAlternateKey)) AS LRTrim, LEN(LTRIM(RTRIM(ProductAlternateKey))) AS LRLen, ASCII(RIGHT(ProductAlternateKey, 1)) AS ASCIIR, ASCII(LEFT(ProductAlternateKey, 1)) AS ASCIIL, ProductAlternateKey from DimProducts where ProductAlternateKey like ‘46783815%’ Result: […]
I am writing a Stored procedure in sql server 2008 I need to check if a table exist in the DB, if it doesn’t then I need to create it. How do I do it?
I would like to return the total number of records in the database so I can set up pagination. How do I return the total number of records in the DB when using the following paging method in SQL Server 2008? ALTER PROCEDURE [dbo].[Nop_LoadAllOptimized] ( @PageSize int = 20, @PageNumber int = 1, @WarehouseCombinationID int […]