Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Test post

Author  Topic 

digory
Starting Member

13 Posts

Posted - 2002-11-07 : 05:40:07
/*
A stored procedure
*/


CREATE PROCEDURE InsertOrder (
@Address VarChar( 255 ),
@ZipCode VarChar( 15 )
AS

INSERT INTO Order ( Name, Address, ZipCode, OrderDate )
VALUES ( 'Some Name', @Address, @ZipCode, GetDate() )

SELECT @@IDENTITY

GO


Mark-up SQLTeam posts here
http://www.markitup.com/Forum/SQLTeam.asp

digory
Starting Member

13 Posts

Posted - 2002-11-07 : 05:49:42
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

create procedure sp_setnetname --- 1995/12/22 13:07
@server sysname -- server name
,@netname sysname -- new net name
as
-- DISALLOW USER TRANSACTION
set implicit_transactions off
if @@trancount > 0
begin
raiserror(15002,-1,-1,'sp_setnetname')
return (1)
end

-- CHECK PERMISSIONS
if not (is_srvrolemember('setupadmin') = 1)
begin
raiserror(15232,-1,-1)
return (1)
end

-- CHECK SERVER NAME (MUST BE A SQL SERVER!)
if not exists (select * from master.dbo.sysservers
where srvname = @server and srvproduct = N'SQL Server')
begin
raiserror(15015,-1,-1,@server)
return (1)
end

-- DO THE UPDATE
update master.dbo.sysservers set datasource = @netname, schemadate = getdate()
where srvname = @server

-- SUCCESS
raiserror(15510,-1,-1)
return (0) -- sp_setnetname

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO




Mark-up SQLTeam posts here
http://www.markitup.com/Forum/SQLTeam.asp
Go to Top of Page

digory
Starting Member

13 Posts

Posted - 2002-11-07 : 06:01:19
For anyone who is interested in using the marking-up tool, you use it as follows:

You paste messages into the textbox at this page [url]http://www.markitup.com/Forum/SQLTeam.asp[/url], and where you have embedded code snippets, you have to tell it with [code=language] code here [/code] tags. Where language can be one of:

vbscript
vbnet
csharp
tsql
javascript
and soon... cplusplus

So, as an example, putting in this:

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

[code=vbscript]dim a
if a = b then[/code]

[code=tsql]select * from test --this is a test[/code]

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

Would return:

----------------------------------
dim a
if a = b then


select * from test --this is a test

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


Mark-up SQLTeam posts here
http://www.markitup.com/Forum/SQLTeam.asp
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-11-07 : 06:10:05
That is very cool.
One suggestion though, if you could leave the original code in the top box so it is easy to make a change that would be awesome.

Damian
Go to Top of Page

digory
Starting Member

13 Posts

Posted - 2002-11-07 : 06:17:51
Done

Please let me know if there's anything else that I can do to make it easier and more useful to use.

Go to Top of Page
   

- Advertisement -