Viewing 15 posts - 721 through 735 (of 2,007 total)
Nicely explained Jeff.
I may have to "borrow" your method of generating random DATETIME data, my method is more difficult to understand when people glance at it. 😀
April 26, 2012 at 7:00 am
ChrisM@Work (4/26/2012)
Cadavre (4/26/2012)
The issue is that you're using formatted data in the database. Instead, you should store this as TIME or DATETIME then convert it to the correct format at...
April 26, 2012 at 6:55 am
Here's a very very not pretty solution.
DECLARE @StandardHours VARCHAR(20) = '133:50:15';
DECLARE @ActualHours VARCHAR(20) = '98:16:57';
SELECT
CAST(diffSeconds/3600 AS VARCHAR(6)) + ':'+ RIGHT('00'+CAST(diffSeconds%(3600)/60 AS VARCHAR(2)),2)+':'+RIGHT('00'+CAST(diffSeconds%60 AS VARCHAR(2)),2)
FROM (SELECT
...
April 26, 2012 at 6:44 am
kotharibij (4/26/2012)
Both my SQL and yours (very interesting SQL), gives the same result.
Day RegTotal
116
4121
532
636
737
836
933
1046
1145
I thought of a calendar table but...
April 26, 2012 at 6:13 am
brally123 (4/26/2012)
*btw: Is there a way to boost your point up thru your answer? I'm kinda new here in this forum.:-)
Nope, the points are pretty meaningless here. You get 1...
April 26, 2012 at 4:31 am
brally123 (4/26/2012)
That was fantastic!
Buuuut, I'm sorry I forgot to add this:
foreach distinct COND in tbl_2, i would...
April 26, 2012 at 3:23 am
dwain.c (4/26/2012)
I didn't realize that if you DECLAREd the local variables within the scope of the dynamic SQL, they would still be in scope upon return to the calling session.
That...
April 26, 2012 at 2:58 am
--First, let's create your sample data
--First table
CREATE TABLE #yourTable1 (ID INT, TAG VARCHAR(5) CHECK (TAG IN ('true','false')), COLOR VARCHAR(10));
INSERT INTO #yourTable1
SELECT ID, TAG, COLOR
FROM (VALUES(1, 'true', 'WHITE'),
...
April 26, 2012 at 2:44 am
vinu512 (4/26/2012)
As far as the Dynamic SQL part goes....you can't have everything always...right??
No. The point I was trying to illustrate with the dynamic SQL I showed you, is that...
April 26, 2012 at 2:00 am
vinu512 (4/25/2012)
Select * From Ex
😀
But I want the results as follows:
Declare
@temp1 varchar(30) = 'Jack',
@temp2 varchar(30) = 'Vinu',
@temp3 varchar(30) = 'Jim',
@temp4 varchar(30) =...
April 25, 2012 at 6:50 am
vinu512 (4/25/2012)
--DDL
Create Table Ex(Name varchar(30) )
--Sample Data
Insert Into Ex
Select 'Jack'
Union all
Select 'Vinu'
Union all
Select 'Jim'
Union all
Select 'Stan'
Union all
Select 'Ash'
I want to loop through the...
April 25, 2012 at 6:03 am
dwain.c (4/23/2012)
DECLARE @Sample TABLE ( Product varchar(10), City varchar(50), Sales decimal(12,2))
INSERT INTO @Sample VALUES('12345','NewYork','20.00')
INSERT INTO @Sample VALUES('54321','NewYork','15.00')
INSERT INTO @Sample VALUES('54321','NewYork','9.00')
INSERT INTO @Sample VALUES('12345','NewHaven','8.00')
SELECT * FROM @Sample
;WITH cte AS (
SELECT Product,...
April 24, 2012 at 7:39 am
spin (4/20/2012)
i'm trying something like...
myproc (@operator varchar(7), @value varchar(25))
as
select col1, col2 from tbl1
where col1 @operator @value
is this kind of dynamic deceleration possible??
thanks
Try something more like this: -
CREATE myproc (@operator VARCHAR(7),...
April 20, 2012 at 3:10 am
salam 52473 (4/20/2012)
I am making attendance management system in VS2010 with RFID technology, doing all my backend data manipulation in SQL server 2005, I know basic SQL, but I'm going...
April 20, 2012 at 2:58 am
ColdCoffee (4/20/2012)
Cadavre (4/20/2012)
Vedran Kesegic (4/19/2012)
April 20, 2012 at 2:49 am
Viewing 15 posts - 721 through 735 (of 2,007 total)