Viewing 15 posts - 106 through 120 (of 429 total)
Original poster asked to have multiple fields not multiple values of fname. There is no need to make multiple selects. It will work fine with
select @body1=@body1 + char(10) + firstname...
November 23, 2005 at 1:05 pm
The post http://www.aspfaq.com/show.asp?id=2501 also says use CASE in ORDER BY CLAUSE. Dynamic SQL should be last thing to think.
For multiple columns use
EXEC('SELECT * FROM blat ORDER BY ' + @col +...
November 23, 2005 at 12:24 pm
select @body1=@body1 + char(10) + firstname, lastname from tblstaff
You are assining a value to varaible @body1. What are you trying to do with lastname.
Query should be
select @body1=@body1 + char(10) +...
November 23, 2005 at 12:14 pm
CREATE PROCEDURE [dbo].[proc_O2_Add_SPID_TariffID]
AS
SET NOCOUNT ON
SET ANSI_PADDING ON
DECLARE @SPID INT
DECLARE @TariffID VARCHAR(3)
DECLARE @TariffName VARCHAR(50)
DECLARE @MobileNo VARCHAR(25)
DECLARE @RecordLength INT
Declare rstO2NetworkBase CURSOR Forward_Only
FOR
SELECT SPID, TariffID, TariffName, MobileNo, RecordLength
FROM tbl_O2_Base_NW_Import
OPEN rstO2NetworkBase
FETCH NEXT FROM rstO2NetworkBase...
November 22, 2005 at 12:26 pm
Can you give more details. When you iterate 1,2,3,4 again how to you realate that with another table.
November 22, 2005 at 6:42 am
But I would want to convert the datatypes of login and logout as DATETIME since if the data is like below it would give a negative time.
SET NOCOUNT ON
GO
DECLARE @myTable...
November 21, 2005 at 10:57 am
SET NOCOUNT ON
GO
DECLARE @myTable TABLE
(
myID INT,
srawlogin VARCHAR(25),
srawlogout VARCHAR(25) NULL,
CallTime INT NULL
)
INSERT @myTable (myID, srawlogin) VALUES (1, '11:45:21')
DECLARE @srawlogout VARCHAR(25)
SET @srawlogout = '11:45:55'
UPDATE @myTable
SET
srawlogout = @srawlogout,
CallTime = DATEDIFF(SECOND, CONVERT(DATETIME, srawlogin), CONVERT(DATETIME, @srawlogout))
WHERE
myID =...
November 21, 2005 at 10:55 am
My Mistake.
I thought any of the words. Not all the words.
I still go with dynamic SQL with AND instead of OR because following search wouldn't return any rows. The words...
November 21, 2005 at 8:58 am
When you use ADO or ADO.net it would be possible to use the resultset in fron end processing. It is used in real world applications.
Within another procedure or with SQL...
November 21, 2005 at 7:48 am
CREATE TABLE #Temp(Col1 datatype, col2 datatype, ...)
INSERT #Temp Exec sp_test
or
DECLARE @myTemp TABLE (Col1 datatype, col2 datatype, ...)
INSERT @myTemp Exec sp_test
Will get the result set into the temp table of current...
November 21, 2005 at 7:07 am
I agree Ian's solution is easy to undersatnd and maintain. I am not sure about the efficiency but I would take that query instead of what I gave for simplicity.
November 21, 2005 at 7:04 am
I would assume for British
DD/MM/YYYY and YYYY-DD-MM formats will work. Date comes before month.
November 21, 2005 at 7:00 am
http://msdn.microsoft.com/library/en-us/tsqlref/ts_sa-ses_9sfo.asp?frame=true
You can use the results whatever way you want for any purpose.
November 21, 2005 at 6:53 am
SET NOCOUNT ON
GO
DECLARE @emc_messageinfo TABLE
(
[Table] INT,
Code INT,
Remark VARCHAR(25)
)
INSERT @emc_messageinfo
SELECT 1, 1, 'This is Customer' UNION
SELECT 1, 2, 'This is Customer' UNION
SELECT 1, 3, 'This is Customer' UNION
SELECT 1, 4, 'This is Customer' UNION
SELECT 2, 1, 'This is...
November 21, 2005 at 6:41 am
You may want to use dynamic SQL. I don't think this solution is elegant.
SET NOCOUNT ON
GO
CREATE TABLE #MyTable
(
myData VARCHAR(100)
)
INSERT INTO #MyTable
SELECT 'Basically' UNION
SELECT 'I' UNION
SELECT 'want' UNION...
November 21, 2005 at 6:19 am
Viewing 15 posts - 106 through 120 (of 429 total)