Custom function call stored procedure solution in SQL Server2008

Source: Internet
Author: User

1. open SQL Server remote connection

open SQL Server Configuration Manager

Configuration SSCM, check the SQL Server service on the left to make sure that SQL Server on the right and SQL Server Browser are running

11

on the left, select the SQLExpress protocol under the SQL Server Network Configuration node, the TCP/IP default on the right is "no", right-enable or double-click to open the Settings panel to modify it to "yes"

Select The IP Address tab and set the TCP port to "1433"

"TCP/IP" of the client protocol is also modified to "Enabled"

in the Control Panel, under System and Security under the Windows Firewall, advanced settings

inbound rules and outbound rules, select New rule, open 1433 Port

2.win7 the Telnet Service is off by default

in the Control Panel (small icon), the program and function   under the turn on or off Windows features

find the "Telnet Server" and "telne Client" Two items, then select the previous tick to open the corresponding service

Enter in cmd terminal window , telnet 192.168.1.49 (IP address ) 1433 , test port is open.

3. Custom Function call stored procedure

-- Create a student table

CREATE TABLE Student (

ID int,

Name varchar (30),

Age int

)

INSERT into student values (1, ' Zhang San ', ();

INSERT into student values (2, ' John Doe ', ();

INSERT into student values (3, ' Harry ', ();

Create proc Wx$opencard (@p_appid varchar), @p_param varchar (20))

As

SELECT * FROM student where id = @p_appid and age = @p_param;

Go

-- call a stored procedure in a function by OpenRowset

Create function test ()

Returns table

As

Return

SELECT * from OPENROWSET (

' Sqloledb.1 ',

' Server=server-pc\sqlexpress;uid=root;pwd=root ',

' EXEC wx$opencard 1,22 '

)

Go

Open OpenRowset method

sp_configure ' show advanced option ', 1;

GO

RECONFIGURE

sp_configure ' Ad Hoc distributed Queries ', 1;

GO

RECONFIGURE

Custom function call stored procedure solution in SQL Server2008

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.