Showing posts with label state. Show all posts
Showing posts with label state. Show all posts

Monday, March 12, 2012

Getting read only database into useable state.

We have a log shipping pair that has the secondary server in a read only
state. My question is how to I get that server into a useable state if there
are no available transaction logs to restore with recovery?
For example the primary server becomes unavailable and all of the logs that
were shipped to the secondary server have already been restored.
Have a look at sp_change_secondary_role. This is the correct way to do it,
although restoring with recovery would also do the trick.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Friday, February 24, 2012

Getting error while using "text" datatype

Hello, I am writing a sproc and am getting this error: Any ideas? Thanks!!

Msg 402, Level 16, State 1, Procedure InsertUserPreferences, Line 18

The data types text and text are incompatible in the equal to operator.

-

create procedure InsertUserPreferences

(

@.PublisherServer text

)

as

begin

if exists(Select Preference_StringList from USER_Preference where Preference_StringList = @.PublisherServer)

begin

--UPDATE

exec dbo.uProc_USER_Preference

end

If you are using 2005, change to using varchar(max) and this will work. You cannot use a text value in a equality comparison

create table test
(
textValue text
)
go
select *
from test
where textValue = ''
go

You could use a cast to only get the first 8000 characters:

select *
from test
where cast(textValue as varchar(8000)) = ''
go

If that will work for you.

Is that your entire proc? How des the update work? If it exists, do you just update the modify date?

|||I will give it a shot and get back with you. Thank you for your help!!!|||Dude that worked!! Thanks man!!!!

Getting error while using "text" datatype

Hello, I am writing a sproc and am getting this error: Any ideas? Thanks!!

Msg 402, Level 16, State 1, Procedure InsertUserPreferences, Line 18

The data types text and text are incompatible in the equal to operator.

-----------------------------------

create procedure InsertUserPreferences

(

@.PublisherServer text

)

as

begin


if exists(Select Preference_StringList from USER_Preference where Preference_StringList = @.PublisherServer)

begin

--UPDATE

exec dbo.uProc_USER_Preference

end

You cannot use an equal operator with TEXT or NTEXT. You can only use LIKE for comparison. Why are you using text, and not varchar? Are you using SQL 2000 or 2005?|||

Hello and thanks for responding!! I restored data from a SQL Server 2000 database to a SQL Server 2005 to meet our requirements. It was our DBA's decision to make that field a datatype of 'text'.

|||I would recommend changing it to VARCHAR if possible.