-
how to do create,insert, select, delete temp table for this condition
HALO THERE..I NEED SOME HELP.
i have do a query sql in the coding side using asp. after i do the searching, i wan to insert it into the temp table in the ms sql server.
below here is the asp code to call the SP to insert the search result into the temp table.:
sqlInsert = "sp_Insert "&photoid&",'"&photoname&"',"&a&",'"& NOW()&"'"
objconn.Execute sqlInsert
after that, i got the problem in create the temp table, insert the result into the table, select out the search result(distinct it) from the temp table and then after display delete the temp table OR maybe got other good ways?
can some one plz help me..urgent.
this is the SP i try to create but seem got problem
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[SP_INSERT]
@PHOTOID NUMERIC(18),
@PHOTONAME VARCHAR(MAX),
@LIGHTBOXNAME VARCHAR(MAX),
@DATEINSERT DATETIME
AS
BEGIN
Create Table #tempmail(
--INSERTDATE DateTime Default(GetDate()),
INSERTDATE DateTime,
PHOTOID VarChar(MAX) NOT NULL,
PHOTONAME VarChar(MAX) NOT NULL,
LIGHTBOXNAME VarChar(MAX) NULL
)
IF (@PHOTOID IS NOT NULL)
BEGIN
INSERT INTO #tempmail (INSERTDATE,PHOTOID,PHOTONAME,LIGHTBOXNAME)
VALUES(@DATEINSERT,@PHOTOID ,@PHOTONAME,@LIGHTBOXNAME)
END
Select * From #tempmail
RETURN
END
hope to hear from u all soon..plz help.thanx
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks