Viewing 15 posts - 481 through 495 (of 1,479 total)
One more way
declare @String varchar(1000)
select @String='nhtinhfsgjsdereSalgjdmexSUM=1290SUMddssfsdfsdfsdsdsdf'
Select SUBSTRING(@String, 1, CHARINDEX('SUM',@String)-1),REVERSE(SUBSTRING(REVERSE(@String), 1, CHARINDEX('MUS',REVERSE(@String))-1))
select substring(@String,
charindex('SUM',@String)+len('SUM='),
charindex('SUM',@String,charindex('SUM',@String)+1)-charindex('SUM',@String)-len('SUM='))
Adi
April 26, 2011 at 5:02 am
When you use the procedure sp_msforeachdb, it loops through the databases, but it is still being run from the database that you are connected to, so it will run you...
April 8, 2011 at 8:27 am
I don't think that cursors are evil. I do think that cursors are being misused a lot and this is what gave them there reputation. You have to...
April 8, 2011 at 8:18 am
Here is one more way:
select
tbl.col.value('(../@name)[1]','varchar(10)'),
tbl.col.value('@name','varchar(10)'),
tbl.col.value('@value', 'int')
from @xmlData.nodes('registry/k/k/v') tbl (col)
Adi
April 6, 2011 at 8:04 am
Like John wrote in his replay you can query sys.sql_modules, but don't forget that you might miss some views. For example if the view checks the value of empid,...
April 6, 2011 at 7:29 am
You have 2 choices. The first choice is to use Unicode instead of ASCII (e.g. nvarchar or nchar instead of varchar or char). If you use Unicode,...
February 8, 2011 at 1:14 am
Are you sure that the problem with your tempdb was caused by the code that you posted? Don’t forget that a different code can use most of the tempdb’s...
February 7, 2011 at 6:47 am
You can check the GMT time (with GETUTCDATE() function) and then add 2 hours to it (to get the local time at Israel). The problem is that this calculation...
February 7, 2011 at 5:17 am
You can find the reason in this URL – http://msdn.microsoft.com/en-us/library/ms178050.aspx. If you don’t specify the column’s source in the subquery, it will first try look for it in...
February 1, 2011 at 6:36 am
As far as I know the only things that you should check is that the table exists on your default schema and that you have permissions to work with this...
January 31, 2011 at 6:11 am
You can create a computed column that does it. When you create a computed column you don't have to specify its data type and you use the key word...
January 31, 2011 at 6:04 am
It should work. I’ve just tested it with the script bellow. Do you have the problem when you run the select statement from a SSMS window or do...
January 31, 2011 at 4:16 am
Are you sure that this is the default schema? Can you check if this is the really the user’s default schema with this query?
select default_schema_name
from sys.database_principals
where name = 'WriteUserNameHere'
Adi
January 31, 2011 at 3:20 am
You have to use the schema’s name and put apostrophes around it (e.g. ‘Risk.TableA’). If it really bothers you, you can try writing your own procedure that will be...
January 31, 2011 at 2:48 am
You are missing the table’s schema in your query. If you didn’t work with schemas then most chances are that the schema name is dbo (which means that the...
January 30, 2011 at 9:03 am
Viewing 15 posts - 481 through 495 (of 1,479 total)