Viewing 15 posts - 61 through 75 (of 156 total)
Check out sp_MSforeachdb
EXEC master.dbo.sp_MSforeachdb 'use [?] select db_name() '
February 8, 2007 at 3:52 pm
Using Charindex and Substring functions will return just a single value. The split function returns a table
If I do a Split function as select * from dbo.split('4;5;6',';') I get...
February 8, 2007 at 2:16 pm
I have used SQL Compare from Redgate. It's a neat tool and also generate SQL scripts for the differences in the Schema. There is a 14-day trial version available.
For...
January 17, 2007 at 6:13 am
This would return 2 rows for each of ColA and ColDescription.
130 3D0041-1 Receptacle 123;456;111
130 3D0041-1 Receptacle 3322;2233;111
130 9D0062-1-08-10 Bracket 12;32;77
130 9D0062-1-08-10 Bracket 12;3254;77
I need either of rows in red and...
January 12, 2007 at 3:29 pm
It does not matter - any row with the least occurance would work.
January 12, 2007 at 3:20 pm
I have to give credit to Igor from where I got this function.
http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,54,33,27115
CREATE function OCCURS(@cSearchExpression nvarchar(4000), @cExpressionSearched nvarchar(4000))
returns smallint
as
begin
return
case
when datalength(@cSearchExpression) > 0
then ...
January 12, 2007 at 3:10 pm
Thanks John. I have a Split functions that return the number of times ';' repeats. How will the query work with the split function ? The query has to return the...
January 12, 2007 at 2:49 pm
Execute this from a database other than Northwind.
DECLARE @DBName varchar(100), @sqlStr varchar(1000)
SET @DBName = 'NorthWind'
SET @sqlstr = 'USE ' + @DBName + ';'
SET @sqlstr = @sqlstr + 'SELECT COUNT(*)...
January 4, 2007 at 3:46 pm
Try this
SELECT count(distinct a.ColumnA) FROM A LEFT JOIN B ON A.ID = B.ID LEFT JOIN C ON A.ID = C.ID
Change ColumnA to any column from table A.
January 4, 2007 at 1:35 pm
SELECT PositionID FROM Employee WHERE ID = 5 returns only one row. ID is the primary key for Employee table. The error I get when I execute the query
SELECT...
January 3, 2007 at 6:20 am
Thanks for your replies.
Remi, why is it a cursor if a function from a select that does a select from the same/different table? Is that like a normal Inner...
January 2, 2007 at 9:42 am
You will have to use a function. Here is a good article that I found - look for OCCURS function
http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,54,33,27115
January 2, 2007 at 6:29 am
Open the DTS package, do a Save As with the new name and delete the old package. Note that the new package will have just the latest version of the...
November 13, 2006 at 1:21 pm
Viewing 15 posts - 61 through 75 (of 156 total)