You are viewing limited content. For full access, please sign in.

Question

Question

Forms SQL help

asked on September 16, 2019

Hello,

I need some help...

I have a Table in SQL which has columns:

Network

IP

Status

 

In forms I have a Table, New IP Request

In the table I want that when a user selects Network, the IP column should show available IP's, which should not have Status in the Status column as "Production" or "Test"

My guess is that I will need some sort of SQL Stored Procedure, but have no experience with it...

 

Can someone kindly help or suggest?

 

Regards,

Sahil

0 0

Answer

SELECTED ANSWER
replied on September 16, 2019

1 0

Replies

replied on September 16, 2019

Hi Sahil,

 

Here you go.

 

1. SQL Table format

2. Store Procedure

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author:          <Mahesh Ramchurn>

-- =============================================

CREATE PROCEDURE spshowIP

       -- Add the parameters for the stored procedure here

      

      

      

AS

BEGIN

       -- SET NOCOUNT ON added to prevent extra result sets from

       -- interfering with SELECT statements.

       SET NOCOUNT ON;

 

    -- Insert statements for procedure here

       select IP from tblnetIPstat where status is null or status = ''

END

GO

 

 

3.LOOKUP RULES

 

4. Form Preview

1 0
replied on September 16, 2019

Okay,

You'll have to modify your Store procedure to pass the variable for the network and it should give you the expected result.

 

Use this SP  below instead, amend where applicable.


-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,Mahesh,Ramchurn>
-- Create date: <Create Date 16,09,2019>
-- Description:	<Description,Select IP Address from Network Range,>
-- =============================================
CREATE PROCEDURE spIP 
	-- Add the parameters for the stored procedure here
	@Network nvarchar(50)

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	select IP from tblnetIPstat where Network = @Network and status is null or status = ''
END
GO


 

Cheers,

MR.   wink

1 0
replied on September 16, 2019

Thanks Mahesh,

Will try & update!

 

Thanks Again!

0 0
replied on September 16, 2019

Sorry Mahesh,

one thing i noticed, in my column Network, the values are the first 3 octates of IP

So if the IP is: 192.168.2.10

Network is: 192.168.2

Based on the selection of Network range the available IP's which are not Test or Production should be shown...

 

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.