Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2004, 05:35 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default Insert into

Hello Everyone,

I will like to take this select statement and insert the results into a table called SQL_Version. can ecyon help?

select SERVERPROPERTY('productversion')As ProductVersion, SERVERPROPERTY ('productlevel')as ProductLevel, SERVERPROPERTY ('edition')as SQLEdition,@@SERVERName

this select statement will give me the SQL version information. What I want to eventually do is run this on every SQL server ang egt the results.

__________________
Jaime E. Maccou
 
Old March 31st, 2004, 04:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

INSERT SQL_Version
select SERVERPROPERTY('productversion')As ProductVersion, SERVERPROPERTY ('productlevel')as ProductLevel, SERVERPROPERTY ('edition')as SQLEdition,@@SERVERName

is that what you're looking for?
 
Old March 31st, 2004, 08:31 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Thank you for your response

This is what I did

1.created a linked server on all my servers
2.created a view to capture result from select statement
2.created a store procedure to call results from view
4.used cast to change data type
3.schedule a job on all servers to insert to the linked server

create view sqlversion
as
SELECT SERVERPROPERTY('productversion')as ProductVersion, SERVERPROPERTY ('productlevel')as ProductLevel, SERVERPROPERTY ('edition')as Edition,@@servername as ServerName


CREATE procedure sp_sqlversions
as
INSERT INTO [SQL_versions].[database].[dbo].[sql_version]
SELECT CAST(ProductVersion AS varchar(50)) AS ProductVersion, CAST(ProductLevel AS varchar(50)) AS ProductLevel,
                     CAST(Edition AS varchar(50)) AS Edition,@@SERVERNAME AS ServerName
FROM dbo.SQLVersion





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert " ". Somesh XML 1 March 6th, 2007 01:30 PM
How to insert " ". Somesh C# 1 March 6th, 2007 08:45 AM
insert into U.N.C.L.E. SQL Language 3 June 6th, 2006 06:35 PM
trigger to insert current date on insert kev_79 SQL Server 2000 3 January 23rd, 2006 05:58 PM
"INSERT INTO" kaz SQL Language 7 December 15th, 2003 07:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.