Showing posts with label sqlserver. Show all posts
Showing posts with label sqlserver. Show all posts

Friday, March 30, 2012

Problem in instead of trigger

hi,
i am using instead of trigger in sqlserver 2005, my trigger looks like
create trigger [dbo].[docsUpdate]
on [dbo].[Docs]
instead of update
as
IF (Update(MetaInfo))
BEGIN
bla bla
bla bla
[Some operation]
end
my table looks lke this
Dirname LeafName TimeLastModified Extension Metainfo
-- -- -- -- --
if any data in metainfo column updated then my trigger will get fired
and do respective operation, but when dirname , leafname or any if
other column get modified other them metainfo then how these modified
data will get affected in to my docs table.
Since changes done on table will not get affected due to instead of
trigger, how can i update other column values.
please help me.
thanks
sathya narayanan
narayanan@.gsdindia.comhttp://www.microsoft.com/communitie...c7-cdfb17b609f8
AMB
"sathya" wrote:

> hi,
>
> i am using instead of trigger in sqlserver 2005, my trigger looks like
>
> create trigger [dbo].[docsUpdate]
> on [dbo].[Docs]
> instead of update
> as
> IF (Update(MetaInfo))
> BEGIN
> bla bla
> bla bla
> [Some operation]
> end
> my table looks lke this
>
> Dirname LeafName TimeLastModified Extension Metainfo
> -- -- -- -- --
>
> if any data in metainfo column updated then my trigger will get fired
> and do respective operation, but when dirname , leafname or any if
> other column get modified other them metainfo then how these modified
> data will get affected in to my docs table.
> Since changes done on table will not get affected due to instead of
> trigger, how can i update other column values.
> please help me.
>
> thanks
> sathya narayanan
> narayanan@.gsdindia.com
>sql

Problem in instead of trigger

hi,
i am using instead of trigger in sqlserver 2005, my trigger looks like
create trigger [dbo].[docsUpdate]
on [dbo].[Docs]
instead of update
as
IF (Update(MetaInfo))
BEGIN
bla bla
bla bla
[Some operation]
end
my table looks lke this
Dirname LeafName TimeLastModified Extension Metainfo
-- -- -- -- --
if any data in metainfo column updated then my trigger will get fired
and do respective operation, but when dirname , leafname or any if
other column get modified other them metainfo then how these modified
data will get affected in to my docs table.
Since changes done on table will not get affected due to instead of
trigger, how can i update other column values.
please help me.
thanks
sathya narayanan
narayanan@.gsdindia.com
http://www.microsoft.com/communities...7-cdfb17b609f8
AMB
"sathya" wrote:

> hi,
>
> i am using instead of trigger in sqlserver 2005, my trigger looks like
>
> create trigger [dbo].[docsUpdate]
> on [dbo].[Docs]
> instead of update
> as
> IF (Update(MetaInfo))
> BEGIN
> bla bla
> bla bla
> [Some operation]
> end
> my table looks lke this
>
> Dirname LeafName TimeLastModified Extension Metainfo
> -- -- -- -- --
>
> if any data in metainfo column updated then my trigger will get fired
> and do respective operation, but when dirname , leafname or any if
> other column get modified other them metainfo then how these modified
> data will get affected in to my docs table.
> Since changes done on table will not get affected due to instead of
> trigger, how can i update other column values.
> please help me.
>
> thanks
> sathya narayanan
> narayanan@.gsdindia.com
>

Problem in instead of trigger

hi,
i am using instead of trigger in sqlserver 2005, my trigger looks like
create trigger [dbo].[docsUpdate]
on [dbo].[Docs]
instead of update
as
IF (Update(MetaInfo))
BEGIN
bla bla
bla bla
[Some operation]
end
my table looks lke this
Dirname LeafName TimeLastModified Extension Metainfo
-- -- -- -- --
if any data in metainfo column updated then my trigger will get fired
and do respective operation, but when dirname , leafname or any if
other column get modified other them metainfo then how these modified
data will get affected in to my docs table.
Since changes done on table will not get affected due to instead of
trigger, how can i update other column values.
please help me.
thanks
sathya narayanan
narayanan@.gsdindia.comhttp://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sqlserver.programming&mid=2144dbff-77b7-4327-b3c7-cdfb17b609f8
AMB
"sathya" wrote:
> hi,
>
> i am using instead of trigger in sqlserver 2005, my trigger looks like
>
> create trigger [dbo].[docsUpdate]
> on [dbo].[Docs]
> instead of update
> as
> IF (Update(MetaInfo))
> BEGIN
> bla bla
> bla bla
> [Some operation]
> end
> my table looks lke this
>
> Dirname LeafName TimeLastModified Extension Metainfo
> -- -- -- -- --
>
> if any data in metainfo column updated then my trigger will get fired
> and do respective operation, but when dirname , leafname or any if
> other column get modified other them metainfo then how these modified
> data will get affected in to my docs table.
> Since changes done on table will not get affected due to instead of
> trigger, how can i update other column values.
> please help me.
>
> thanks
> sathya narayanan
> narayanan@.gsdindia.com
>

Problem in insert a datetime into SqlServer 2005

I user Visual Studio 2005 64 bit ,windowxp 64 bit ,sqlserver 2005

The Sql statement : "insert into sickleave (StaffID,sickLeaveReason,DateStart,DateEnd,RegistrationDate) values (20001,'test',28/3/2006,4/5/2006,4/5/2006 ) "

and the result in Datebase (All the time become 1/1/1900 0:00:00 )

Although i change the datetype from datetime to smalldatetime the result is same

and i try input the date 28/3/2006 0:00:00 into server but

it show the error:Incorrect syntax near '0'.

What wrong ? help me please,Thank.

They have to be passed as strings:
insert into sickleave (StaffID,sickLeaveReason,DateStart,DateEnd,RegistrationDate) values (20001,'test','3/28/2006','5/4/2006','5/4/2006' ) "
or as ISO values which is preferable
insert into sickleave (StaffID,sickLeaveReason,DateStart,DateEnd,RegistrationDate) values (20001,'test',20060328,20060405,20060405 ) "
HTH, jens Suessmeyer.

|||

Your date is in the future (28th of March this year). That is not allowed:

Server: Msg 242, Level 16, State 3, Line 4
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Server: Msg 296, Level 16, State 3, Line 5
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.

HTH

|||

I prefer to use dates in the following format 'yyyy-mm-dd'.

Have you tried that already (as mentioned above)?

WesleyB

Visit my SQL Server weblog @. http://dis4ea.blogspot.com

|||

@.Original Poster: Could you please track the status of the post ? Thanks.

-Jens

sql

Wednesday, March 28, 2012

Problem in emailing to operator in SQLAgent

Hi
I got the following error when I tested emailing to the operator in Sql
Server Agent.
"Error 22022 : SQLServerAgent Error. The SQLServerAgent mail session is
not running; check the mail profile and/or the SQLServerAgent service
startup account in the SQLServerAgent properties dialog."
However, if I stopped and then started the SQL Server Agent again, I can
send email to the operator successfully. The problem happened again when the
server is restarted.
Here are some checks on my server.
- Running SQL2000 (SP4) on SBS2003. Outlook client 2003.
- Mail profile is using Exchange 2003, not POP3
- Mail Profile test in Sql Server Agent is alway OK even though I cannot
send email to operator.
- SQL Server Agent service startup account = SQL server service startup
account = mail profile mail box AD account
- SQL server agent is set to start automatically with Sql Server
Any idea for solving this problem?
Edwin
Hi Edwin,
Welcome to use MSDN Managed Newsgroup!
From your descriptions, I understood your SQL Agent won't launch smoothly
until you have restarted it. If I have misunderstood your concern, please
feel free to point it out.
First of all, please make sure SQL Server and SQL Agent services are
starting with same domain accounts. Does the domain account has
Administrator privilege?
Secondly, it is really strange that the restart of service will fix this
scenario. Would you pelase check the Event Log to see if there is any more
related information?
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi Michael
SQL Agent did launch successfully. Scheduled job can run. Testing of mail
profile is OK. Even xp_sendmail can work in query analyzer. The only
problem is cannot email to operator from SQLAgent when needed (such as a job
failed).
As said, SQL Server service startup a/c = SQLAgent service startup a/c = the
AD a/c used to setup the mail profile on the server. The AD a/c is member of
domain administrators group.
No warning or error events are found regarding MSSQLSERVER and
MSSQLSERVERAGENT event source.
This is not an occasional event. It happened in my old SBS2000. After I
migrated it to SBS2003, the problem is still there. Of course the two
servers are using similar settings and so I think some settings cause the
problem.
Any ideas?
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
> Welcome to use MSDN Managed Newsgroup!
> From your descriptions, I understood your SQL Agent won't launch smoothly
> until you have restarted it. If I have misunderstood your concern, please
> feel free to point it out.
> First of all, please make sure SQL Server and SQL Agent services are
> starting with same domain accounts. Does the domain account has
> Administrator privilege?
> Secondly, it is really strange that the restart of service will fix this
> scenario. Would you pelase check the Event Log to see if there is any more
> related information?
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ================================================== ===
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
|||Hi Edwin,
This is a really strange issue that you will have to the restart of SQL
Agent to
Since the machine was restarted, the SQL Agent was also restarted. I am not
sure why it need twice restart.
Would you please perform the steps below and let me know the result?
When the machine was restarted execute the following statements directly in
the
EXECUTE master.dbo.xp_sqlagent_notify 'N', NULL, NULL, NULL, 'E',
N'edwinchan@.nospam.nospam'
--Make sure to replace edwinchan@.nospam.nospam
--with a valid test email destination address
Whether it will send the email as expected?
After this, execute the same statement after the SQL Agent was restarted
twice.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi Michael
I got the same error from query analyser.
Server: Msg 22022, Level 16, State 1, Line 0
SQLServerAgent Error: The SQLServerAgent mail session is not running; check
the mail profile and/or the SQLServerAgent service startup account in the
SQLServerAgent Properties dialog.
I have browsed through the event log. No errors or warnings on SQLSERVER
and SQLSERVERAGENT. But I do find two event 101 after server is restarted.
Event Type:Information
Event Source:SQLSERVERAGENT
Event Category:Service Control
Event ID:101
Date:11/18/2005
Time:7:00:02 AM
User:N/A
Computer:AIMS
Description:
SQLServerAgent service successfully started.
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
They occured about 20 seconds apart. Not sure whether this is normal or not.
It seems to me that it is about timing when the SQLServerAgent service is
started. It is just not started at the right time. Will it matter if
SQLServerAgent service is started when Exchange is not completely started?
I have not started SQLServerAgent service yet. What else would you like to
test?
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
> This is a really strange issue that you will have to the restart of SQL
> Agent to
> Since the machine was restarted, the SQL Agent was also restarted. I am not
> sure why it need twice restart.
> Would you please perform the steps below and let me know the result?
> When the machine was restarted execute the following statements directly in
> the
> EXECUTE master.dbo.xp_sqlagent_notify 'N', NULL, NULL, NULL, 'E',
> N'edwinchan@.nospam.nospam'
> --Make sure to replace edwinchan@.nospam.nospam
> --with a valid test email destination address
> Whether it will send the email as expected?
> After this, execute the same statement after the SQL Agent was restarted
> twice.
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ================================================== ===
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
|||Hi Edwin,
[vbcol=seagreen]
is[vbcol=seagreen]
started?
You have installed the Exchange Server on the same machine?
If the Exchange Server is started behind SQL Server Agent's start, the mail
profiler may not get the correct information.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi Michael
As said, my server is running SBS2003 and it is assumed to have Exchange2003
and SQL server 2000 running in the same machine. I think all of the SBS
users are doing that way; otherwise why buy SBS? If the problem is caused
by having Exchange and SQL server running in the same machine, it is
obviously a design fault of the product. Is there any work around from
Microsoft? How can I restart SQLAgent Service automatically after each
reboot?
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
> is
> started?
> You have installed the Exchange Server on the same machine?
> If the Exchange Server is started behind SQL Server Agent's start, the mail
> profiler may not get the correct information.
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ================================================== ===
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
|||Hi Edwin,
Thanks for the update.
Would you pleaes let me know how to do you create the Mail Profile?
First of all, please understand we do not support installing Exchange
Server with Outlook together.
Microsoft does not support installing Exchange Server components and
Outlook on the same computer
http://support.microsoft.com/?id=266418
However, you could configure your SQL Mail as described below
How to create MAPI profiles without installing Outlook
http://support.microsoft.com/kb/306962/en-us
Secondly, you may add dependency to Exchange Services for SQLAgent Services
or SQL Server Services.
-1- Start -> Run -> services.msc
-2- Find all the service name for each Exchange Servicew
(For example, the service name for Microsoft Exchange POP3 is POP3Svc, you
could see this when you check the properties for each service)
-3- Start -> Run -> Regedit
-4- Open Key DependOnService under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SQLSERVERAGENT
-5- Input all Services from Step -2- to DependOnService
-6- Restart the machine to see whether it works
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi Michael
Yes, Outlook was installed in the server. I have read the article 306962
but found it is not quite user friendly to follow through. First of all I
cannot find NewProf.exe in the Outlook 2003 CD came with my SBS. I looked
into ProfMan2.exe but it just mentioned Outlook 2000 compliant and so I am
not sure it can be used in Exchange 2003 or not. The other approaches looked
quite unfamilar to me because it required to write some programs to do the
job. I hope MS can suggest a more user friendly way to create a mail profile
in Exchange 2003.
Anyway, making the SQLSERVERAGENT service dependent on MSExchangeIS service
solved my problem. Hence it seems it was caused by having SQLSERVERAGENT
started too early.
Regards
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
> Thanks for the update.
> Would you pleaes let me know how to do you create the Mail Profile?
> First of all, please understand we do not support installing Exchange
> Server with Outlook together.
> Microsoft does not support installing Exchange Server components and
> Outlook on the same computer
> http://support.microsoft.com/?id=266418
> However, you could configure your SQL Mail as described below
> How to create MAPI profiles without installing Outlook
> http://support.microsoft.com/kb/306962/en-us
> Secondly, you may add dependency to Exchange Services for SQLAgent Services
> or SQL Server Services.
> -1- Start -> Run -> services.msc
> -2- Find all the service name for each Exchange Servicew
> (For example, the service name for Microsoft Exchange POP3 is POP3Svc, you
> could see this when you check the properties for each service)
> -3- Start -> Run -> Regedit
> -4- Open Key DependOnService under
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SQLSERVERAGENT
> -5- Input all Services from Step -2- to DependOnService
> -6- Restart the machine to see whether it works
> Thank you for your patience and cooperation. If you have any questions or
> concerns, don't hesitate to let me know. We are always here to be of
> assistance!
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ================================================== ===
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
|||Hi Edwin,
It's great to hear it was resolved by making the dependency.
Thanks so much for your suggestions and I will submit your concerns about
mail profile creation via internal resources. In the meanwhile, you are
also encouraged to submit this feeling via the link below
http://lab.msdn.microsoft.com/produc...k/default.aspx
If you have any questions or concerns next time, don't hesitate to let me
know. We are always here to be of assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

Problem in emailing to operator in SQLAgent

Hi
I got the following error when I tested emailing to the operator in Sql
Server Agent.
"Error 22022 : SQLServerAgent Error. The SQLServerAgent mail session is
not running; check the mail profile and/or the SQLServerAgent service
startup account in the SQLServerAgent properties dialog."
However, if I stopped and then started the SQL Server Agent again, I can
send email to the operator successfully. The problem happened again when th
e
server is restarted.
Here are some checks on my server.
- Running SQL2000 (SP4) on SBS2003. Outlook client 2003.
- Mail profile is using Exchange 2003, not POP3
- Mail Profile test in Sql Server Agent is alway OK even though I cannot
send email to operator.
- SQL Server Agent service startup account = SQL server service startup
account = mail profile mail box AD account
- SQL server agent is set to start automatically with Sql Server
Any idea for solving this problem?
EdwinHi Edwin,
Welcome to use MSDN Managed Newsgroup!
From your descriptions, I understood your SQL Agent won't launch smoothly
until you have restarted it. If I have misunderstood your concern, please
feel free to point it out.
First of all, please make sure SQL Server and SQL Agent services are
starting with same domain accounts. Does the domain account has
Administrator privilege?
Secondly, it is really strange that the restart of service will fix this
scenario. Would you pelase check the Event Log to see if there is any more
related information?
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Michael
SQL Agent did launch successfully. Scheduled job can run. Testing of mail
profile is OK. Even xp_sendmail can work in query analyzer. The only
problem is cannot email to operator from SQLAgent when needed (such as a job
failed).
As said, SQL Server service startup a/c = SQLAgent service startup a/c = the
AD a/c used to setup the mail profile on the server. The AD a/c is member o
f
domain administrators group.
No warning or error events are found regarding MSSQLSERVER and
MSSQLSERVERAGENT event source.
This is not an occasional event. It happened in my old SBS2000. After I
migrated it to SBS2003, the problem is still there. Of course the two
servers are using similar settings and so I think some settings cause the
problem.
Any ideas?
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
> Welcome to use MSDN Managed Newsgroup!
> From your descriptions, I understood your SQL Agent won't launch smoothly
> until you have restarted it. If I have misunderstood your concern, please
> feel free to point it out.
> First of all, please make sure SQL Server and SQL Agent services are
> starting with same domain accounts. Does the domain account has
> Administrator privilege?
> Secondly, it is really strange that the restart of service will fix this
> scenario. Would you pelase check the Event Log to see if there is any more
> related information?
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>|||Hi Edwin,
This is a really strange issue that you will have to the restart of SQL
Agent to
Since the machine was restarted, the SQL Agent was also restarted. I am not
sure why it need twice restart.
Would you please perform the steps below and let me know the result?
When the machine was restarted execute the following statements directly in
the
EXECUTE master.dbo.xp_sqlagent_notify 'N', NULL, NULL, NULL, 'E',
N'edwinchan@.nospam.nospam'
--Make sure to replace edwinchan@.nospam.nospam
--with a valid test email destination address
Whether it will send the email as expected?
After this, execute the same statement after the SQL Agent was restarted
twice.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Michael
I got the same error from query analyser.
Server: Msg 22022, Level 16, State 1, Line 0
SQLServerAgent Error: The SQLServerAgent mail session is not running; check
the mail profile and/or the SQLServerAgent service startup account in the
SQLServerAgent Properties dialog.
I have browsed through the event log. No errors or warnings on SQLSERVER
and SQLSERVERAGENT. But I do find two event 101 after server is restarted.
Event Type: Information
Event Source: SQLSERVERAGENT
Event Category: Service Control
Event ID: 101
Date: 11/18/2005
Time: 7:00:02 AM
User: N/A
Computer: AIMS
Description:
SQLServerAgent service successfully started.
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
They occured about 20 seconds apart. Not sure whether this is normal or not
.
It seems to me that it is about timing when the SQLServerAgent service is
started. It is just not started at the right time. Will it matter if
SQLServerAgent service is started when Exchange is not completely started?
I have not started SQLServerAgent service yet. What else would you like to
test?
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
> This is a really strange issue that you will have to the restart of SQL
> Agent to
> Since the machine was restarted, the SQL Agent was also restarted. I am no
t
> sure why it need twice restart.
> Would you please perform the steps below and let me know the result?
> When the machine was restarted execute the following statements directly i
n
> the
> EXECUTE master.dbo.xp_sqlagent_notify 'N', NULL, NULL, NULL, 'E',
> N'edwinchan@.nospam.nospam'
> --Make sure to replace edwinchan@.nospam.nospam
> --with a valid test email destination address
> Whether it will send the email as expected?
> After this, execute the same statement after the SQL Agent was restarted
> twice.
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>|||Hi Edwin,
[vbcol=seagreen]
is[vbcol=seagreen]
started?
You have installed the Exchange Server on the same machine?
If the Exchange Server is started behind SQL Server Agent's start, the mail
profiler may not get the correct information.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Michael
As said, my server is running SBS2003 and it is assumed to have Exchange2003
and SQL server 2000 running in the same machine. I think all of the SBS
users are doing that way; otherwise why buy SBS' If the problem is caused
by having Exchange and SQL server running in the same machine, it is
obviously a design fault of the product. Is there any work around from
Microsoft? How can I restart SQLAgent Service automatically after each
reboot?
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
>
> is
> started?
> You have installed the Exchange Server on the same machine?
> If the Exchange Server is started behind SQL Server Agent's start, the mai
l
> profiler may not get the correct information.
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>|||Hi Edwin,
Thanks for the update.
Would you pleaes let me know how to do you create the Mail Profile?
First of all, please understand we do not support installing Exchange
Server with Outlook together.
Microsoft does not support installing Exchange Server components and
Outlook on the same computer
http://support.microsoft.com/?id=266418
However, you could configure your SQL Mail as described below
How to create MAPI profiles without installing Outlook
http://support.microsoft.com/kb/306962/en-us
Secondly, you may add dependency to Exchange Services for SQLAgent Services
or SQL Server Services.
-1- Start -> Run -> services.msc
-2- Find all the service name for each Exchange Servicew
(For example, the service name for Microsoft Exchange POP3 is POP3Svc, you
could see this when you check the properties for each service)
-3- Start -> Run -> Regedit
-4- Open Key DependOnService under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\SQLSERVERAGENT
-5- Input all Services from Step -2- to DependOnService
-6- Restart the machine to see whether it works
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Michael
Yes, Outlook was installed in the server. I have read the article 306962
but found it is not quite user friendly to follow through. First of all I
cannot find NewProf.exe in the Outlook 2003 CD came with my SBS. I looked
into ProfMan2.exe but it just mentioned Outlook 2000 compliant and so I am
not sure it can be used in Exchange 2003 or not. The other approaches looke
d
quite unfamilar to me because it required to write some programs to do the
job. I hope MS can suggest a more user friendly way to create a mail profil
e
in Exchange 2003.
Anyway, making the SQLSERVERAGENT service dependent on MSExchangeIS service
solved my problem. Hence it seems it was caused by having SQLSERVERAGENT
started too early.
Regards
Edwin
"Michael Cheng [MSFT]" wrote:

> Hi Edwin,
> Thanks for the update.
> Would you pleaes let me know how to do you create the Mail Profile?
> First of all, please understand we do not support installing Exchange
> Server with Outlook together.
> Microsoft does not support installing Exchange Server components and
> Outlook on the same computer
> http://support.microsoft.com/?id=266418
> However, you could configure your SQL Mail as described below
> How to create MAPI profiles without installing Outlook
> http://support.microsoft.com/kb/306962/en-us
> Secondly, you may add dependency to Exchange Services for SQLAgent Service
s
> or SQL Server Services.
> -1- Start -> Run -> services.msc
> -2- Find all the service name for each Exchange Servicew
> (For example, the service name for Microsoft Exchange POP3 is POP3Svc, you
> could see this when you check the properties for each service)
> -3- Start -> Run -> Regedit
> -4- Open Key DependOnService under
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\SQLSERVERAGENT
> -5- Input all Services from Step -2- to DependOnService
> -6- Restart the machine to see whether it works
> Thank you for your patience and cooperation. If you have any questions or
> concerns, don't hesitate to let me know. We are always here to be of
> assistance!
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>|||Hi Edwin,
It's great to hear it was resolved by making the dependency.
Thanks so much for your suggestions and I will submit your concerns about
mail profile creation via internal resources. In the meanwhile, you are
also encouraged to submit this feeling via the link below
http://lab.msdn.microsoft.com/produ...ck/default.aspx
If you have any questions or concerns next time, don't hesitate to let me
know. We are always here to be of assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

Problem in displaying or inserting data into sqlserver tables using utf

i have such a error in my sql server db
i examined arabic_ci_as and SQL_Latin1_General_CP1256_CI_AS
but in my web pages that uses utf-8 codepage that retrieves data using ado and asp scripting the ouput or inserted that dispalyed in both of query analyzer and Enterprise manager replaces or display '???' for characters .
i am using nchar and nvarchar and ntextany one to help me i need it emergenciely
with thanks arqa|||Originally posted by arqa
i have such a error in my sql server db
i examined arabic_ci_as and SQL_Latin1_General_CP1256_CI_AS
but in my web pages that uses utf-8 codepage that retrieves data using ado and asp scripting the ouput or inserted that dispalyed in both of query analyzer and Enterprise manager replaces or display '???' for characters .
i am using nchar and nvarchar and ntext

i must add that i am using with farsi localization winserver 2k|||How about status of windows locale?

It is required to install Arabic language support on OS part.

Do not use an Arabic name for the SQL server.
For further details, please refer to the SQL server and Arabic support whitepaper below: http://www.microsoft.com/middleeast/arabicdev/dotnetservers/SQL
/wpapers.asp#sql_arabicsupport_installingsqlserver
The windows code page must be the same on both the server and the client.

The recommended is standard Arabic code page is 1256.|||hi satya thanks to your answer

i am already localized my windows to farsi(arabic) and i have not any problem with typing in farsi and local setting but i dont know how i can
setup(!) arabic(farsi) in remote sqlserver is because it is far from me and i have not any control and you think realy i need to do such a thing or no becuse the remote server hosts large number of databases in deffernet code page and the os not reachable(!?) .
other thing is that how i can use same code page to client and server
in this case i am using a sqlserver for hosting my data gather from a website in other host that is far away other this is that this page must viewed by any users that may not localized windows or OS i use it for a web site and for a web based goal i think i must use unicode code page for this utf-8 and i must use such a code page in both sql server and
my webpages to display informations(data) in none localized OS or
systems but know i dont know what i must to do the below code is peace of code that i used to create table in remote server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Member_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Member_Info]
GO
CREATE TABLE [dbo].[Member_Info] (
[id] [bigint] IDENTITY (1, 1) NOT NULL ,
[First] [nvarchar] (50) COLLATE Arabic_CI_AS NULL ,
[Last] [nvarchar] (50) COLLATE Arabic_CI_AS NULL ,
[Father_Name] [nchar] (50) COLLATE Arabic_CI_AS NULL ,
[Date_Birth] [decimal](18, 0) NULL ,
[Birt_num] [bigint] NULL ,
[Birt_Place] [nvarchar] (50) COLLATE Arabic_CI_AS NULL ,
[Mariage_Condition] [nvarchar] (50) COLLATE Arabic_CI_AS NULL ,
[Colg_cond] [nchar] (20) COLLATE Arabic_CI_AS NULL ,
....................
i am examined
sql_latin1_general_cp1256 for this manner but is not fullfil me and the results is not defferent and not changed(!?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
i have some question that is i install arabic is that
and other thing that i confused arabic name i dont use arbic name for
dose it mean a database name such as members_db or other things but i am using english name for my db name and tables name and collmns name and the only thing must be none english is the data is inserted into tables.|||Thanx for Your Attention.
i am study more about this problem but suddenly i cant solve it but i am grasp some new thing about .
i am using A FORM page AND a Insert Page (USING ASP/ADO SCRIPTING) and
Unicode (utf-8) Code Page In Both Page AND ARABIC_CI_AS Collation And nvarchar() ans nchar data Type In SQLSERVER Ta i am get the below results.
1.when i am using This<% @.CODEPAGE="65001" %> directive In Both Page The Insert Data is Simlar To '??' And all characters Replaced With '?'s and it is Wrong And In My Webpages Displayed Like '??' When i remove
the code page directive in second page(Insertion Page) The Data is Inserted and Displayed correct in webpage but i cant see it in Enterprise Manager but in this manner the data isn't display like before but like a manner that code page(collation) is not correct in my client computer becuse i am examined a query that compare and its work correctly (My Computer Locals is Farsi) how i can solve this problem PLEASE CONTACT ME VIA EMAIL .
thanks

Monday, March 26, 2012

problem in connection with SQLServer using DSN

Hi all,
I am using OdbcConnection for coonectivity with SQL Server db. My code
is working fine with windows application but in ASP.NET or in
webservice its raising following exception -
"ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL
Server does not exist or access denied.
ERROR [01000] [Microsoft][ODBC SQL Server Driver]
[DBNETLIB]ConnectionOpen (Connect())."
at System.Data.Odbc.OdbcConnection.Open()
Same code is working fine for Orace DSN.
My code:
OdbcConnection conn = new
OdbcConnection("dsn=MyDsn;uid=sa;pwd=stars;");
conn.Open();
Please help me to sort out this problem
Thanks
Dharmendra
I expect the reason that no one jumped on this question (which has been
asked and answered a million times) is that you're clearly not following the
advice given here and elsewhere. I suggest you do some reading about getting
connected to SQL Server. The 4th through 6th Editions of my Hitchhiker's
Guide to Visual Basic and SQL Server discuss how to connect via ODBC to SQL
Server. However, they do not talk about the fact that recent versions of SQL
Server require that you enable connectivity before attempting to connect.
This is covered in detail in my latest book and in whitepapers posted on my
blog (see www.betav.com/blogs/billva). And be sure to stop using SA
credentials to handle your customer's data...
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"tomar" <dharmendratomar2000@.gmail.com> wrote in message
news:1179209227.270257.149380@.n59g2000hsh.googlegr oups.com...
> Hi all,
> I am using OdbcConnection for coonectivity with SQL Server db. My code
> is working fine with windows application but in ASP.NET or in
> webservice its raising following exception -
> "ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL
> Server does not exist or access denied.
> ERROR [01000] [Microsoft][ODBC SQL Server Driver]
> [DBNETLIB]ConnectionOpen (Connect())."
> at System.Data.Odbc.OdbcConnection.Open()
> Same code is working fine for Orace DSN.
> My code:
> OdbcConnection conn = new
> OdbcConnection("dsn=MyDsn;uid=sa;pwd=stars;");
> conn.Open();
>
> Please help me to sort out this problem
> Thanks
> Dharmendra
>
|||Thanks for response.
I have tested it dsn through Odbcad32 . It gets connected with sql
server db but when I try to connect via ASP.NET code. It gives error.
Important thing is that
when I load the application with same code on other machine. It works
fine.
Regards
Dharmendra,
================================================== =======
On May 17, 1:20 am, "William \(Bill\) Vaughn"
<billvaRemoveT...@.betav.com> wrote:
> I expect the reason that no one jumped on this question (which has been
> asked and answered a million times) is that you're clearly not following the
> advice given here and elsewhere. I suggest you do some reading about getting
> connected to SQL Server. The 4th through 6th Editions of my Hitchhiker's
> Guide to Visual Basic and SQL Server discuss how to connect via ODBC to SQL
> Server. However, they do not talk about the fact that recent versions of SQL
> Server require that you enable connectivity before attempting to connect.
> This is covered in detail in my latest book and in whitepapers posted on my
> blog (seewww.betav.com/blogs/billva). And be sure to stop using SA
> credentials to handle your customer's data...
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speakerwww.betav.com/blog/billvawww.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no rights.
> __________________________________
> Visitwww.hitchhikerguides.netto get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> ----X---
> "tomar" <dharmendratomar2...@.gmail.com> wrote in message
> news:1179209227.270257.149380@.n59g2000hsh.googlegr oups.com...
>
>
>
>
>
> - Show quoted text -

problem in connection with SQLServer using DSN

Hi all,
I am using OdbcConnection for coonectivity with SQL Server db. My code
is working fine with windows application but in ASP.NET or in
webservice its raising following exception -
"ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]
SQL
Server does not exist or access denied.
ERROR [01000] [Microsoft][ODBC SQL Server Driver]
[DBNETLIB]ConnectionOpen (Connect())."
at System.Data.Odbc.OdbcConnection.Open()
Same code is working fine for Orace DSN.
My code:
OdbcConnection conn = new
OdbcConnection("dsn=MyDsn;uid=sa;pwd=stars;");
conn.Open();
Please help me to sort out this problem
Thanks
DharmendraI expect the reason that no one jumped on this question (which has been
asked and answered a million times) is that you're clearly not following the
advice given here and elsewhere. I suggest you do some reading about getting
connected to SQL Server. The 4th through 6th Editions of my Hitchhiker's
Guide to Visual Basic and SQL Server discuss how to connect via ODBC to SQL
Server. However, they do not talk about the fact that recent versions of SQL
Server require that you enable connectivity before attempting to connect.
This is covered in detail in my latest book and in whitepapers posted on my
blog (see www.betav.com/blogs/billva). And be sure to stop using SA
credentials to handle your customer's data...
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"tomar" <dharmendratomar2000@.gmail.com> wrote in message
news:1179209227.270257.149380@.n59g2000hsh.googlegroups.com...
> Hi all,
> I am using OdbcConnection for coonectivity with SQL Server db. My code
> is working fine with windows application but in ASP.NET or in
> webservice its raising following exception -
> "ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLI
B]SQL
> Server does not exist or access denied.
> ERROR [01000] [Microsoft][ODBC SQL Server Driver]
> [DBNETLIB]ConnectionOpen (Connect())."
> at System.Data.Odbc.OdbcConnection.Open()
> Same code is working fine for Orace DSN.
> My code:
> OdbcConnection conn = new
> OdbcConnection("dsn=MyDsn;uid=sa;pwd=stars;");
> conn.Open();
>
> Please help me to sort out this problem
> Thanks
> Dharmendra
>|||Thanks for response.
I have tested it dsn through Odbcad32 . It gets connected with sql
server db but when I try to connect via ASP.NET code. It gives error.
Important thing is that
when I load the application with same code on other machine. It works
fine.
Regards
Dharmendra,
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
On May 17, 1:20 am, "William \(Bill\) Vaughn"
<billvaRemoveT...@.betav.com> wrote:
> I expect the reason that no one jumped on this question (which has been
> asked and answered a million times) is that you're clearly not following =
the
> advice given here and elsewhere. I suggest you do some reading about gett=
ing
> connected to SQL Server. The 4th through 6th Editions of my Hitchhiker's
> Guide to Visual Basic and SQL Server discuss how to connect via ODBC to S=
QL
> Server. However, they do not talk about the fact that recent versions of =
SQL
> Server require that you enable connectivity before attempting to connect.
> This is covered in detail in my latest book and in whitepapers posted on =
my
> blog (seewww.betav.com/blogs/billva). And be sure to stop using SA
> credentials to handle your customer's data...
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speakerwww.betav.com/blog/billvawww.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no right=
s=2E
> __________________________________
> Visitwww.hitchhikerguides.netto get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> ----=
--=AD---
> "tomar" <dharmendratomar2...@.gmail.com> wrote in message
> news:1179209227.270257.149380@.n59g2000hsh.googlegroups.com...
>
>
>
>
>
>
>
>
> - Show quoted text -sql

problem in connecting two sqlserver

Hi,..Please help me..

We have two server on pulbilc ip A , B in other country, and there replication will working fine. But i want to replicate data from one online server(A) to my local office(in my country) server(C). means from public ip to private(A->C). then some one told me that you have to put both server on public for replication. after the i put my local server(c) on public ip. but now i am facing the problem that i am able to connect C to A(means my office server to other country server) but not able to connect A to C(means other country server to my office server). when i am connecting from A to C then error shows is "defaut sqlserver server does not allow remote connection". I have change all the sql settings..and also done required changes in firewall but not successed. my operating system 2003 and database sql2005........ please help me................ASAP

thanks and regards

Vipin yadav

Can you check the following on machine C (aka: your office server),

Open "SQL Server Configuration Manager",

- expand the "SQL Server 2005 Network Configuration" node

- select "Protocols for MSSQLSERVER"

- enable "TCP/IP" if it's not already enabled and restart MSSQLSERVER service

See if that would solve your problem.

Regards,

Gary

|||He might want to have a look on

http://www.sqlserver2005.de/Screencast/Screencast.aspx?ScreencastId=1

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||I have already done this.. still not connecting|||Check http://blogs.msdn.com/sql_protocols/archive/2005/12/22/506607.aspx for troubleshooting connectivity issues with SQL Server 2005. Also, run SQL Server Surface Area Configuration. Click Surface Area Configuration for Services and Connections and check the Remote Connections option. Make sure you have Local and remote connections option selected

Friday, March 23, 2012

Problem in accessing the database(Sqlserver 2005) from client machine

Hi

We have upgraded sql server 2000 to sqlserver 2005 on the development server.

To access the database server, we installed the sql server management studio on the client PC with Admin Account. The .Net framework and sqlserver management studio were installed and I am able to access the database from the client PC using Admin Login. Then we logged off and tried to login as user account on the client PC. From the user account login we are unable to open the sql server management studio. The error is as follows

“The proper type library could not be found in system registry”

The client PC configuration : windows 2000 Professional ( sp4)

Regards,

K.S.Subba Rao

Hi K.S. Subba,

What is probably happening is the non-Admin user that you are logging on with does not have permissions to read the appropriate type library informations for SQL-specific COM components from registry. The fastest approach you can take to troubleshoot that is to use RegMon from http://www.microsoft.com/technet/sysinternals/SystemInformation/Regmon.mspx, find out which keys are "Access Denied" or "Not Found" and when logged as Admin, grant the permissions to those to the non-Admin user. As a lazy alternative you could try to grant permissions to the user to HKEY_LOCAL_MACHINE\SOFTWARE\Classes and all the subcomponents, but that might expose a security risk.

HTH,
Jivko Dobrev - MSFT
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Monday, March 12, 2012

problem error no 9003

in sqlserver 2000 i am properly deteched the database. in attached
time i am face the problem error no 9003 but mdf and log are present.
i am traie to this script.
Create Database with exact name and mdf-ldf files (sobmmainserverdep
i am create)
2. Stop MSSQLSERVER service, replace created mdf file with original
one
3. Start MSSQLSERVER service, the database will be in Suspend mode
4. From Query Analyzer (QA) execute script
use master
go
sp_configure 'allow updates', 1
reconfigure with override
go
5. From QA execute script
update sysdatabases set status= 32768 where name = '<db_name>'
ex("db_name =sobmmainserverdep")
6. Restart MSSQLSERVER service, the database will be in Emergency mode
7. Rebuild Log. From QA execute script
DBCC REBUILD_LOG('<db_name>', '<full name to new log file>'). You got
a
message - Warning: The log for database '<db_name>' has been rebuilt.
ex.(db_name is sobmmainserverdep , new log file is
sobmmainserverdep_log).
8. From QA execute script
Use master
go
sp_configure 'allow updates', 0
Go
9. Clear from Enterprise Manager on database properties options tab
Restrict
access checkbox
in 7 possition i am not rebuild the log file. and they provied the
error like "Device activation error. The physical file name
'sobmmainserverdep_log' may be incorrect.
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
"
so plez help i am attacehed the database in properly.
mail me
shishu05@.gmail.com
shishu_05@.rediffmail.comshishu,
You apparently are copying over only the mdf to replace the existing mdf.
You should also copy the ldf to replace the existing ldf.
If you really get stuck, this undocument, unsupported, not for the timid
procedure from Jasper Smith saved me once upon a time.
http://www.tech-archive.net/Archive...04-03/3026.html
RLF
"love shishu" <shishu05@.gmail.com> wrote in message
news:1186240282.891142.286540@.q3g2000prf.googlegroups.com...
> in sqlserver 2000 i am properly deteched the database. in attached
> time i am face the problem error no 9003 but mdf and log are present.
> i am traie to this script.
> Create Database with exact name and mdf-ldf files (sobmmainserverdep
> i am create)
> 2. Stop MSSQLSERVER service, replace created mdf file with original
> one
> 3. Start MSSQLSERVER service, the database will be in Suspend mode
> 4. From Query Analyzer (QA) execute script
> use master
> go
> sp_configure 'allow updates', 1
> reconfigure with override
> go
> 5. From QA execute script
> update sysdatabases set status= 32768 where name = '<db_name>'
> ex("db_name =sobmmainserverdep")
> 6. Restart MSSQLSERVER service, the database will be in Emergency mode
> 7. Rebuild Log. From QA execute script
> DBCC REBUILD_LOG('<db_name>', '<full name to new log file>'). You got
> a
> message - Warning: The log for database '<db_name>' has been rebuilt.
> ex.(db_name is sobmmainserverdep , new log file is
> sobmmainserverdep_log).
>
> 8. From QA execute script
> Use master
> go
> sp_configure 'allow updates', 0
> Go
> 9. Clear from Enterprise Manager on database properties options tab
> Restrict
> access checkbox
> in 7 possition i am not rebuild the log file. and they provied the
> error like "Device activation error. The physical file name
> 'sobmmainserverdep_log' may be incorrect.
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
> "
> so plez help i am attacehed the database in properly.
> mail me
> shishu05@.gmail.com
> shishu_05@.rediffmail.com
>

problem error no 9003

in sqlserver 2000 i am properly deteched the database. in attached
time i am face the problem error no 9003 but mdf and log are present.
i am traie to this script.
Create Database with exact name and mdf-ldf files (sobmmainserverdep
i am create)
2. Stop MSSQLSERVER service, replace created mdf file with original
one
3. Start MSSQLSERVER service, the database will be in Suspend mode
4. From Query Analyzer (QA) execute script
use master
go
sp_configure 'allow updates', 1
reconfigure with override
go
5. From QA execute script
update sysdatabases set status= 32768 where name = '<db_name>'
ex("db_name =sobmmainserverdep")
6. Restart MSSQLSERVER service, the database will be in Emergency mode
7. Rebuild Log. From QA execute script
DBCC REBUILD_LOG('<db_name>', '<full name to new log file>'). You got
a
message - Warning: The log for database '<db_name>' has been rebuilt.
ex.(db_name is sobmmainserverdep , new log file is
sobmmainserverdep_log).
8. From QA execute script
Use master
go
sp_configure 'allow updates', 0
Go
9. Clear from Enterprise Manager on database properties options tab
Restrict
access checkbox
in 7 possition i am not rebuild the log file. and they provied the
error like "Device activation error. The physical file name
'sobmmainserverdep_log' may be incorrect.
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
"
so plez help i am attacehed the database in properly.
mail me
shishu05@.gmail.com
shishu_05@.rediffmail.comshishu,
You apparently are copying over only the mdf to replace the existing mdf.
You should also copy the ldf to replace the existing ldf.
If you really get stuck, this undocument, unsupported, not for the timid
procedure from Jasper Smith saved me once upon a time.
http://www.tech-archive.net/Archive/SQL-Server/microsoft.public.sqlserver.server/2004-03/3026.html
RLF
"love shishu" <shishu05@.gmail.com> wrote in message
news:1186240282.891142.286540@.q3g2000prf.googlegroups.com...
> in sqlserver 2000 i am properly deteched the database. in attached
> time i am face the problem error no 9003 but mdf and log are present.
> i am traie to this script.
> Create Database with exact name and mdf-ldf files (sobmmainserverdep
> i am create)
> 2. Stop MSSQLSERVER service, replace created mdf file with original
> one
> 3. Start MSSQLSERVER service, the database will be in Suspend mode
> 4. From Query Analyzer (QA) execute script
> use master
> go
> sp_configure 'allow updates', 1
> reconfigure with override
> go
> 5. From QA execute script
> update sysdatabases set status= 32768 where name = '<db_name>'
> ex("db_name =sobmmainserverdep")
> 6. Restart MSSQLSERVER service, the database will be in Emergency mode
> 7. Rebuild Log. From QA execute script
> DBCC REBUILD_LOG('<db_name>', '<full name to new log file>'). You got
> a
> message - Warning: The log for database '<db_name>' has been rebuilt.
> ex.(db_name is sobmmainserverdep , new log file is
> sobmmainserverdep_log).
>
> 8. From QA execute script
> Use master
> go
> sp_configure 'allow updates', 0
> Go
> 9. Clear from Enterprise Manager on database properties options tab
> Restrict
> access checkbox
> in 7 possition i am not rebuild the log file. and they provied the
> error like "Device activation error. The physical file name
> 'sobmmainserverdep_log' may be incorrect.
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
> "
> so plez help i am attacehed the database in properly.
> mail me
> shishu05@.gmail.com
> shishu_05@.rediffmail.com
>

problem error no 9003

in sqlserver 2000 i am properly deteched the database. in attached
time i am face the problem error no 9003 but mdf and log are present.
i am traie to this script.
Create Database with exact name and mdf-ldf files (sobmmainserverdep
i am create)
2. Stop MSSQLSERVER service, replace created mdf file with original
one
3. Start MSSQLSERVER service, the database will be in Suspend mode
4. From Query Analyzer (QA) execute script
use master
go
sp_configure 'allow updates', 1
reconfigure with override
go
5. From QA execute script
update sysdatabases set status= 32768 where name = '<db_name>'
ex("db_name =sobmmainserverdep")
6. Restart MSSQLSERVER service, the database will be in Emergency mode
7. Rebuild Log. From QA execute script
DBCC REBUILD_LOG('<db_name>', '<full name to new log file>'). You got
a
message - Warning: The log for database '<db_name>' has been rebuilt.
ex.(db_name is sobmmainserverdep , new log file is
sobmmainserverdep_log).
8. From QA execute script
Use master
go
sp_configure 'allow updates', 0
Go
9. Clear from Enterprise Manager on database properties options tab
Restrict
access checkbox
in 7 possition i am not rebuild the log file. and they provied the
error like "Device activation error. The physical file name
'sobmmainserverdep_log' may be incorrect.
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
"
so plez help i am attacehed the database in properly.
mail me
[email]shishu_05@.rediffmail.com" rel="nofollow">shishu05@.gmail.com[/email]
[email]shishu_05@.rediffmail.com
shishu,
You apparently are copying over only the mdf to replace the existing mdf.
You should also copy the ldf to replace the existing ldf.
If you really get stuck, this undocument, unsupported, not for the timid
procedure from Jasper Smith saved me once upon a time.
http://www.tech-archive.net/Archive/SQL-Server/microsoft.public.sqlserver.server/2004-03/3026.html
RLF
"love shishu" <shishu05@.gmail.com> wrote in message
news:1186240282.891142.286540@.q3g2000prf.googlegro ups.com...
> in sqlserver 2000 i am properly deteched the database. in attached
> time i am face the problem error no 9003 but mdf and log are present.
> i am traie to this script.
> Create Database with exact name and mdf-ldf files (sobmmainserverdep
> i am create)
> 2. Stop MSSQLSERVER service, replace created mdf file with original
> one
> 3. Start MSSQLSERVER service, the database will be in Suspend mode
> 4. From Query Analyzer (QA) execute script
> use master
> go
> sp_configure 'allow updates', 1
> reconfigure with override
> go
> 5. From QA execute script
> update sysdatabases set status= 32768 where name = '<db_name>'
> ex("db_name =sobmmainserverdep")
> 6. Restart MSSQLSERVER service, the database will be in Emergency mode
> 7. Rebuild Log. From QA execute script
> DBCC REBUILD_LOG('<db_name>', '<full name to new log file>'). You got
> a
> message - Warning: The log for database '<db_name>' has been rebuilt.
> ex.(db_name is sobmmainserverdep , new log file is
> sobmmainserverdep_log).
>
> 8. From QA execute script
> Use master
> go
> sp_configure 'allow updates', 0
> Go
> 9. Clear from Enterprise Manager on database properties options tab
> Restrict
> access checkbox
> in 7 possition i am not rebuild the log file. and they provied the
> error like "Device activation error. The physical file name
> 'sobmmainserverdep_log' may be incorrect.
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
> "
> so plez help i am attacehed the database in properly.
> mail me
> shishu05@.gmail.com
> shishu_05@.rediffmail.com
>

Problem Displaying Japanese Characters

We are a software developer here and ran into a problem trying to get SQL
Server Query Analyzer to display Japanese Characters fetched through a linked
server properly. Can someone comment on the situation?
The following configurations were able to display Japanese characters
properly:
================================================== ===
1. Write a C# application to get Japanese characters from an AS400 table
containing Japanese texts. The Japanese text was displayed on the DataGrid.
The provider used was HiT OLEDB Server/400. A 30 day eval copy can be
obtained from the following link:
http://www.hitsw.com/products_servic...b_svr_400.html
2. Create a table containing Japanese text on SQL Server A and create a
linked server on SQL Server B linking to SQL Server A. Change the font type
of SQL Server B's query analyzer to a font that is compatible with Japanese
character. (See the bottom of this message for the code used to create the
table on SQL Sever A)
3. On a new PC, install Japanese edition of Windows 2000 plus Japanese
Edition of SQL Server 2000. Create a linked server pointing to a Japanes
table on the AS400 using the HiT OLEDB provider.
The following configurations were not able to display Japanese characters
properly:
================================================== ===
i. On a PC with English version of Windows 2000 Professional and English
version of SQL Server, change the query analyzer font to a font that is
compitable with Japanese text and then use the HiT OLEDB provider to create a
linked server pointing to the Japanese table on the AS400.
ii. On the same PC above, install IBM Client Access and make a new linked
server pointing to the same Japanese table on the AS400 using Client Access.
A Japanese compitable font was selected in the query anaylzer.
The odd thing is that in configuration (1), we were able to see the Japanese
characters correctly which suggests that the HiT OLEDB provider has passed
the information back to the PC correctly. And in configuration (2) and (3),
we were able to show that SQL Server Query Analyzer has no problem displaying
Japanese characters regardless of its language edition.
We are not sure why it is behaving this way. Does anybody have any thought?
Here is the code used to generate the table on SQL Server:
Code Sample One
===============
The following code was used on an English version of SQL Server 2000 running
on an English version of Windows
2000 professional
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[tblJap]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)
drop table [dbo].[tblJap]
GO
CREATE TABLE [dbo].[tblJap] (
[CID] [int] IDENTITY (1, 1) NOT NULL ,
[Jap] [nchar] (30) NOT NULL ,
[Eng] [char] (30) NOT NULL
) ON [PRIMARY]
GO
INSERT INTO tblJap (Jap, Eng) VALUES ('織田信長','Oda Nobunaga')
INSERT INTO tblJap (Jap, Eng) VALUES ('豊臣秀吉','Toyotomi Hideyoshi')
INSERT INTO tblJap (Jap, Eng) VALUES ('徳川家康','Tokugawa Ieyasu')
--See note below
GO
SELECT * FROM tblJap
Note
====
Another odd thing was that if I run the code
INSERT INTO tblJap (Jap, Eng) VALUES ('織田信長','Oda Nobunaga')
from query analyzer, the Japanese characters showed up as ? in Enterprise
Manager. But if I edit the information again from Enterprise Manager, it
shows up properly in both Enterprise Manager and Query Analyzer.
Fabio,
Probably a problem with the way the HiT driver handles DBCS characters.
I suggest you try with StarSQL (www.starquest.com), it is another quite
reliable driver for DB2 and the support is pretty good.
Good luck,
Bob
Fabio Boscaini a =C3=A9crit :
> We are a software developer here and ran into a problem trying to get SQL
> Server Query Analyzer to display Japanese Characters fetched through a li=
nked
> server properly. Can someone comment on the situation?
> The following configurations were able to display Japanese characters
> properly:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> 1. Write a C# application to get Japanese characters from an AS400 table
> containing Japanese texts. The Japanese text was displayed on the DataGri=
d=2E
> The provider used was HiT OLEDB Server/400. A 30 day eval copy can be
> obtained from the following link:
> http://www.hitsw.com/products_servic...db_svr_400.ht=
ml
> 2. Create a table containing Japanese text on SQL Server A and create a
> linked server on SQL Server B linking to SQL Server A. Change the font ty=
pe
> of SQL Server B's query analyzer to a font that is compatible with Japane=
se
> character. (See the bottom of this message for the code used to create the
> table on SQL Sever A)
> 3. On a new PC, install Japanese edition of Windows 2000 plus Japanese
> Edition of SQL Server 2000. Create a linked server pointing to a Japanes
> table on the AS400 using the HiT OLEDB provider.
> The following configurations were not able to display Japanese characters
> properly:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> i. On a PC with English version of Windows 2000 Professional and English
> version of SQL Server, change the query analyzer font to a font that is
> compitable with Japanese text and then use the HiT OLEDB provider to crea=
te a
> linked server pointing to the Japanese table on the AS400.
> ii. On the same PC above, install IBM Client Access and make a new linked
> server pointing to the same Japanese table on the AS400 using Client Acce=
ss.
> A Japanese compitable font was selected in the query anaylzer.
> The odd thing is that in configuration (1), we were able to see the Japan=
ese
> characters correctly which suggests that the HiT OLEDB provider has passed
> the information back to the PC correctly. And in configuration (2) and (3=
),
> we were able to show that SQL Server Query Analyzer has no problem displa=
ying
> Japanese characters regardless of its language edition.
> We are not sure why it is behaving this way. Does anybody have any though=
t?
> Here is the code used to generate the table on SQL Server:
> Code Sample One
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> The following code was used on an English version of SQL Server 2000 runn=
ing
> on an English version of Windows
> 2000 professional
> if exists (select * from dbo.sysobjects where id =3D
> object_id(N'[dbo].[tblJap]') and OBJECTPROPERTY(id,
> N'IsUserTable') =3D 1)
> drop table [dbo].[tblJap]
> GO
> CREATE TABLE [dbo].[tblJap] (
> [CID] [int] IDENTITY (1, 1) NOT NULL ,
> [Jap] [nchar] (30) NOT NULL ,
> [Eng] [char] (30) NOT NULL
> ) ON [PRIMARY]
> GO
> INSERT INTO tblJap (Jap, Eng) VALUES ('=E7=B9=94=E7=94=B0=E4=BF=A1=E9=95=
=B7','Oda Nobunaga')
> INSERT INTO tblJap (Jap, Eng) VALUES ('=E8=B1=8A=E8=87=A3=E7=A7=80=E5=90=
=89','Toyotomi Hideyoshi')
> INSERT INTO tblJap (Jap, Eng) VALUES ('=E5=BE=B3=E5=B7=9D=E5=AE=B6=E5=BA=
=B7','Tokugawa Ieyasu')
> --See note below
> GO
> SELECT * FROM tblJap
> Note
> =3D=3D=3D=3D
> Another odd thing was that if I run the code
> INSERT INTO tblJap (Jap, Eng) VALUES ('=E7=B9=94=E7=94=B0=E4=BF=A1=E9=95=
=B7','Oda Nobunaga')
> from query analyzer, the Japanese characters showed up as ? in Enterpr=
ise
> Manager. But if I edit the information again from Enterprise Manager, it
> shows up properly in both Enterprise Manager and Query Analyzer.

Wednesday, March 7, 2012

problem creating DTS package

Hi,
I am trying to create a DTS package wherein the data from the sql
server is transfered to a text file. I am using the Transform Data Task
to transfer the data.In Transform Data task properties, I build the
query and able to preview the data but when i click OK in the Transform
Data task properties screen I get the following error.
"To continue , define transformations. You can make changes to the
default transformations"
I am not able to define the transformations. Has anyone had this
problem and know a way to resolve it. I would appreciate if anyone
could help me.
Thanks
MBare you working on the server or throught the EMC remotely?|||are you working on the server or through the EMC remotely?|||Mohan wrote:
> Hi,
> I am trying to create a DTS package wherein the data from the sql
> server is transfered to a text file. I am using the Transform Data Task
> to transfer the data.In Transform Data task properties, I build the
> query and able to preview the data but when i click OK in the Transform
> Data task properties screen I get the following error.
> "To continue , define transformations. You can make changes to the
> default transformations"
> I am not able to define the transformations. Has anyone had this
> problem and know a way to resolve it. I would appreciate if anyone
> could help me.
> Thanks
> MB
>
You need to define the transformations first before you can click OK.
The text file must be defined with column names and then the
transformations can be assigned.|||I am actually using the remote connection to work directly on the
server.
i was able to get it to work if i selected some of the columns, but not
all. Is there a limit on the number of columns?
Let me explain in more detail.
When i am setting up the transform data task, I build the query and
then go to the destination tab. I click the Execute button to define
the columns for the destination.
The problem is that when i select all the columns from the table then
nothing happens when i click Execute. There are no columns defined and
when i click on the Define Columns button it gives an error and
terminates Enterprise Manager.
I am not sure whats going on. Really appreciate your help
Thanks
MB|||Mohan wrote:
> I am actually using the remote connection to work directly on the
> server.
> i was able to get it to work if i selected some of the columns, but not
> all. Is there a limit on the number of columns?
> Let me explain in more detail.
> When i am setting up the transform data task, I build the query and
> then go to the destination tab. I click the Execute button to define
> the columns for the destination.
> The problem is that when i select all the columns from the table then
> nothing happens when i click Execute. There are no columns defined and
> when i click on the Define Columns button it gives an error and
> terminates Enterprise Manager.
> I am not sure whats going on. Really appreciate your help
> Thanks
> MB
>
What service pack is SQL Server running on? That may be part of the
issue if you have a large amount of columns to export.|||Its running on SP3.|||Mohan wrote:
> *Its running on SP3. *
I figured out a fix without having to upgrade to SP4. If you don't
upgrade your client tools to SP3 on your computer you don't have the
errors. I had to uninstall my client tools and re-install the client
tools on my machine (not on the server). There were no issues. Its
not a pretty fix, but I can always use any new functionality on the
server itself. Good luck.
dmasuda
---
Posted via http://www.mcse.ms
---
View this thread: http://www.mcse.ms/message2000028.html|||This thread is confusing... ..
What was the error you got was it "Invalid Class String" Error?
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and
time
asking back if its 2000 or 2005]
"dmasuda" wrote:

> Mohan wrote:
> I figured out a fix without having to upgrade to SP4. If you don't
> upgrade your client tools to SP3 on your computer you don't have the
> errors. I had to uninstall my client tools and re-install the client
> tools on my machine (not on the server). There were no issues. Its
> not a pretty fix, but I can always use any new functionality on the
> server itself. Good luck.
>
> --
> dmasuda
> ---
> Posted via http://www.mcse.ms
> ---
> View this thread: http://www.mcse.ms/message2000028.html
>

problem creating DTS package

Hi,
I am trying to create a DTS package wherein the data from the sql
server is transfered to a text file. I am using the Transform Data Task
to transfer the data.In Transform Data task properties, I build the
query and able to preview the data but when i click OK in the Transform
Data task properties screen I get the following error.
"To continue , define transformations. You can make changes to the
default transformations"
I am not able to define the transformations. Has anyone had this
problem and know a way to resolve it. I would appreciate if anyone
could help me.
Thanks
MB
are you working on the server or throught the EMC remotely?
|||are you working on the server or through the EMC remotely?
|||Mohan wrote:
> Hi,
> I am trying to create a DTS package wherein the data from the sql
> server is transfered to a text file. I am using the Transform Data Task
> to transfer the data.In Transform Data task properties, I build the
> query and able to preview the data but when i click OK in the Transform
> Data task properties screen I get the following error.
> "To continue , define transformations. You can make changes to the
> default transformations"
> I am not able to define the transformations. Has anyone had this
> problem and know a way to resolve it. I would appreciate if anyone
> could help me.
> Thanks
> MB
>
You need to define the transformations first before you can click OK.
The text file must be defined with column names and then the
transformations can be assigned.
|||I am actually using the remote connection to work directly on the
server.
i was able to get it to work if i selected some of the columns, but not
all. Is there a limit on the number of columns?
Let me explain in more detail.
When i am setting up the transform data task, I build the query and
then go to the destination tab. I click the Execute button to define
the columns for the destination.
The problem is that when i select all the columns from the table then
nothing happens when i click Execute. There are no columns defined and
when i click on the Define Columns button it gives an error and
terminates Enterprise Manager.
I am not sure whats going on. Really appreciate your help
Thanks
MB
|||Mohan wrote:
> I am actually using the remote connection to work directly on the
> server.
> i was able to get it to work if i selected some of the columns, but not
> all. Is there a limit on the number of columns?
> Let me explain in more detail.
> When i am setting up the transform data task, I build the query and
> then go to the destination tab. I click the Execute button to define
> the columns for the destination.
> The problem is that when i select all the columns from the table then
> nothing happens when i click Execute. There are no columns defined and
> when i click on the Define Columns button it gives an error and
> terminates Enterprise Manager.
> I am not sure whats going on. Really appreciate your help
> Thanks
> MB
>
What service pack is SQL Server running on? That may be part of the
issue if you have a large amount of columns to export.
|||Its running on SP3.
|||

Quote:

Originally posted by Mohan
Its running on SP3.

I figured out a fix without having to upgrade to SP4. If you don't upgrade your client tools to SP3 on your computer you don't have the errors. I had to uninstall my client tools and re-install the client tools on my machine (not on the server). There were no issues. Its not a pretty fix, but I can always use any new functionality on the server itself. Good luck.|||This thread is confusing... ..
What was the error you got was it "Invalid Class String" Error?
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"dmasuda" wrote:

> Mohan wrote:
> I figured out a fix without having to upgrade to SP4. If you don't
> upgrade your client tools to SP3 on your computer you don't have the
> errors. I had to uninstall my client tools and re-install the client
> tools on my machine (not on the server). There were no issues. Its
> not a pretty fix, but I can always use any new functionality on the
> server itself. Good luck.
>
> --
> dmasuda
> Posted via http://www.mcse.ms
> View this thread: http://www.mcse.ms/message2000028.html
>

Saturday, February 25, 2012

Problem creating a function from an assembly

I have compiled a dll with the following code:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Server
Imports System.Data.SqlTypes

Public Class SICTrans

Public Shared Function TransSIC(ByVal inpSIC As String) As String
'Dim conn As SqlConnection = New SqlConnection("context connection=true")
Dim NewSIC, TempSIC, tempFSIC As String

If Len(NZ(inpSIC)) > 0 Then
TempSIC = NZ(inpSIC)

If Len(TempSIC) < 5 Then TempSIC = Left("00000", 5 - Len(TempSIC))

tempFSIC = Left(TempSIC, 2) + "." + Mid(TempSIC, 3, 2)

If Val(Right(TempSIC, 1)) > 0 Then

tempFSIC = tempFSIC + "/" + Right(TempSIC, 1)
End If
End If

NewSIC = tempFSIC

TransSIC = NewSIC

End Function
Public Shared Function NZ(ByVal input As String) As String
If Not (input Is Nothing) Then
Return input
Exit Function
End If
Return String.Empty

End Function
End Class

Which compiles fine...

i then use the following code to create the assembly in SQL which is fine:

USE NARD
GO
CREATE ASSEMBLY SICCodeTrans
FROM 'c:\SICCodeTrans.dll'
WITH PERMISSION_SET = SAFE
GO

but when i goto create the function with the following code it wont have it!

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.SICTrans.TransSIC
GO

It gives me the following error message

Msg 6505, Level 16, State 1, Procedure TransSICCode, Line 1
Could not find Type 'SICTrans' in assembly 'SICCodeTrans'.

Any ideas?

Thanks

Marek Kluczynski

I think what's going on here is that there is a root namespace on the project.

IIRC, in a C# project VS will simply insert the root namespace delcaration into your code when you use certain templates. In VB, on the other hand, the compiler decides to insert the namespace definition without having it show up in the code.

When you go to create the function in SQL, it can't find it because there is no SICTrans class in the default namespace, there is a SICTrans class in whatever root namespace was set on the project.

You can right-click on the project in VS and pull up the propertiesunder the "Application" tab you'll see this.

Assuming your namespace is NAMESPACE, you'd think you could do the following:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.NAMESPACE.SICTrans.TransSIC
GO

This won't workit's a (rather annoying) syntax error. You have to write it like this:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.[NAMESPACE.SICTrans].TransSIC
GO

Hope this works for you. Let us know. :)

Cheers
-Isaac

|||

yes this seems to have resolved the namespace error.

I now have the following error:

Msg 6551, Level 16, State 2, Procedure TransSICCode, Line 1

CREATE FUNCTION for "TransSICCode" failed because T-SQL and CLR types for return value do not match.

Many thanks

Marek

|||I suspect two things. First, you should map the string to an nvarchar, not a varcharCLR strings are Unicode. Second, you need to give a parameter to the nvarchar, e.g., nvarchar(4000), nvarchar(max), etc.

Cheers,
-Isaac|||Many thanks for all your help

Problem creating a function from an assembly

I have compiled a dll with the following code:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Server
Imports System.Data.SqlTypes

Public Class SICTrans

Public Shared Function TransSIC(ByVal inpSIC As String) As String
'Dim conn As SqlConnection = New SqlConnection("context connection=true")
Dim NewSIC, TempSIC, tempFSIC As String

If Len(NZ(inpSIC)) > 0 Then
TempSIC = NZ(inpSIC)

If Len(TempSIC) < 5 Then TempSIC = Left("00000", 5 - Len(TempSIC))

tempFSIC = Left(TempSIC, 2) + "." + Mid(TempSIC, 3, 2)

If Val(Right(TempSIC, 1)) > 0 Then

tempFSIC = tempFSIC + "/" + Right(TempSIC, 1)
End If
End If

NewSIC = tempFSIC

TransSIC = NewSIC

End Function
Public Shared Function NZ(ByVal input As String) As String
If Not (input Is Nothing) Then
Return input
Exit Function
End If
Return String.Empty

End Function
End Class

Which compiles fine...

i then use the following code to create the assembly in SQL which is fine:

USE NARD
GO
CREATE ASSEMBLY SICCodeTrans
FROM 'c:\SICCodeTrans.dll'
WITH PERMISSION_SET = SAFE
GO

but when i goto create the function with the following code it wont have it!

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.SICTrans.TransSIC
GO

It gives me the following error message

Msg 6505, Level 16, State 1, Procedure TransSICCode, Line 1
Could not find Type 'SICTrans' in assembly 'SICCodeTrans'.

Any ideas?

Thanks

Marek Kluczynski

I think what's going on here is that there is a root namespace on the project.

IIRC, in a C# project VS will simply insert the root namespace delcaration into your code when you use certain templates. In VB, on the other hand, the compiler decides to insert the namespace definition without having it show up in the code.

When you go to create the function in SQL, it can't find it because there is no SICTrans class in the default namespace, there is a SICTrans class in whatever root namespace was set on the project.

You can right-click on the project in VS and pull up the propertiesunder the "Application" tab you'll see this.

Assuming your namespace is NAMESPACE, you'd think you could do the following:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.NAMESPACE.SICTrans.TransSIC
GO

This won't workit's a (rather annoying) syntax error. You have to write it like this:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.[NAMESPACE.SICTrans].TransSIC
GO

Hope this works for you. Let us know. :)

Cheers
-Isaac

|||

yes this seems to have resolved the namespace error.

I now have the following error:

Msg 6551, Level 16, State 2, Procedure TransSICCode, Line 1

CREATE FUNCTION for "TransSICCode" failed because T-SQL and CLR types for return value do not match.

Many thanks

Marek

|||I suspect two things. First, you should map the string to an nvarchar, not a varcharCLR strings are Unicode. Second, you need to give a parameter to the nvarchar, e.g., nvarchar(4000), nvarchar(max), etc.

Cheers,
-Isaac|||Many thanks for all your help

Problem copy a table from SQLServer 2000 data base to SQLExpress database using SMO.

I am trying to to copy a table from a SQLserver 2000 database to a new table in as SQLExpress database. The following is the code I used.

Private Sub btnCopyTable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopyTable.Click

Try
mFromDatabase = New Database(mFromSrv, Me.cboSelectFromDatabase.Text)
mToDatabase = New Database(mFromSrv, Me.cboSelectToDatabase.Text)
'mToDatabase.Create()
Dim xfr As New Transfer
xfr.CopyAllTables = False
'xfr.Options.WithDependencies = False
'xfr.Options.ContinueScriptingOnError = True
xfr.DestinationDatabase = Me.cboSelectToDatabase.Text
xfr.DestinationServer = mFromSrv.Name
xfr.DestinationLoginSecure = True
xfr.CopySchema = True
xfr.TransferData()
Catch ex As Exception
Dim errMsg As String
errMsg = ex.ToString
Throw
End Try


End Sub

When I do this I get the following error on the xfr.TransferData line.

Microsoft.SqlServer.Management.Smo.SmoException: The Integration Services component is not installed or you do not have permission to use it. > System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.DtsTransferProvider, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.SqlServer.DtsTransferProvider, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.SqlServer.Management.Smo.Transfer.CreateDtsTransferProvider()

=== Pre-bind state information ===
LOG: User = ACER-1\phowatt
LOG: DisplayName = Microsoft.SqlServer.DtsTransferProvider, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
(Fully-specified)
LOG: Appbase = file:///D:/VS2005_Projects/AnalyzeProjects/Forms/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\VS2005_Projects\AnalyzeProjects\Forms\bin\Forms.vshost.exe.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.SqlServer.DtsTransferProvider, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: Attempting download of new URL file:///D:/VS2005_Projects/AnalyzeProjects/Forms/bin/Microsoft.SqlServer.DtsTransferProvider.DLL.
LOG: Attempting download of new URL file:///D:/VS2005_Projects/AnalyzeProjects/Forms/bin/Microsoft.SqlServer.DtsTransferProvider/Microsoft.SqlServer.DtsTransferProvider.DLL.
LOG: Attempting download of new URL file:///D:/VS2005_Projects/AnalyzeProjects/Forms/bin/Microsoft.SqlServer.DtsTransferProvider.EXE.
LOG: Attempting download of new URL file:///D:/VS2005_Projects/AnalyzeProjects/Forms/bin/Microsoft.SqlServer.DtsTransferProvider/Microsoft.SqlServer.DtsTransferProvider.EXE.

End of inner exception stack trace
at Microsoft.SqlServer.Management.Smo.Transfer.CreateDtsTransferProvider()
at Microsoft.SqlServer.Management.Smo.Transfer.GetTransferProvider()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Forms.frmTransfer.btnCopyTable_Click(Object sender, EventArgs e) in D:\VS2005_Projects\AnalyzeProjects\Forms\frmTransfer.vb:line 149

I used the following references with this code.

Microsoft.SqlServer.ConnectionInfo

Microsoft.SqlServer.Smo

Microsoft.SqlServer.SmoEnum

Microsoft.SqlServer.SqlEnum

SMO uses SSIS to perform data transfer operations, but SQL Server Express doesn't install the SSIS engine, so the transfer operation fails because the service SMO relies on to perform the operation doesn't exist on the machine you're running on. On this page of my blog - http://sqljunkies.com/WebLog/marathonsqlguy/archive/2006/10/31/24756.aspx - I described how to build a table from an existing one. Perhaps you can use this code to build your destination tables, and then use Transact-SQL to copy the data from the source to the destination database.|||I also have SQL Server 2005. If I install it will that install SSIS? Is there another way to install the SSIS engine? Or maybe your recommended approach is the better approach in any case.|||The full versions (Developer, Standard, Enterprise) of SQL Server allow you to install SSIS, which I believe will solve your problem (based on the error messages in your first post.)|||I have written myself a little application that enables me to set the various copy properties and option properties and then display the resulting scripts so that I can see how the various copy and option property settings affect the outcome. Since there is little documentation about SMO you cannot depend on your intuition about how these different property settings might affect the resulting script. Also there is IMO a shortcomming in the scripting of views. The problem occurs when there are views that are based on other views. If the underlying views are not created first then there will be an error when using the script when trying to create a view that uses another view and that other view has not yet been created. You might think that setting the CopyAllViews to True and setting the Options.WithDependencies to True would be how to deal with that but it appears that the Options.WithDependencies only affects scripts for tables. It appears that if you try to copy a database from one server to another and there are views like I have described above the Transfer will fail and it seems that there is no way to set the options to avoid this problem. So it appears that copying a database using Transfer will work only if there are no conditions in the source database that Transfer cannot handle.