Viewing 15 posts - 8,146 through 8,160 (of 8,731 total)
Check the code and look for the part where the sql statement is completed and stored into @sql.
In there, you just have to add the INTO clause.
You might want to...
April 10, 2013 at 10:18 am
r_slot (4/10/2013)
April 10, 2013 at 9:36 am
ScottPletcher (4/9/2013)
SQL will automatically cast the result to the receiving data type; cast will automatically round.
I've always thought it truncated the decimals instead of rounding them (which also happens). Afters...
April 9, 2013 at 3:25 pm
Is there any reason to use ROLLUP when a simple GROUP BY is enough?
April 9, 2013 at 2:58 pm
It's good to know the solution worked fine. However, you should understand it before using it.
Two tips I can give you are to use the PRINT command I included but...
April 9, 2013 at 2:16 pm
It shouldn't be rounding if you're not explicitly rounding it.
Can you post DDL for the table that contain those fields?
If you're using ROUND(), use the third argument (with a...
April 8, 2013 at 6:23 pm
Something like this?
WITH Sample_Data AS(SELECT 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' string)
SELECT SUBSTRING( string, 1, 10) + CHAR( 10) +
SUBSTRING( string, 11, 10) + CHAR( 10) +
SUBSTRING( string, 21, 10) + CHAR( 10)...
April 8, 2013 at 5:50 pm
This is mostly a dynamic cross-tab. It's not that hard when you understand them, but you need to be really careful on what you're doing.
Please, test the code and be...
April 8, 2013 at 5:46 pm
Are you serious j.miner? Take a look at J Livingston code, it's way simpler.
I just would change the having clause for a where clause (to filter the information before grouping...
April 8, 2013 at 4:35 pm
You could use CHAR(10) or CHAR(13) (depending on the output).
Could you give an example on what you're trying to do? or explain more the reason to have several lines?
April 8, 2013 at 4:11 pm
Steven, it's great that you look for alternate solutions. However, you might want to make it simpler. You're scaning the "table" multiple times and using several window functions. If you're...
April 8, 2013 at 12:55 pm
I got more confused.
Could you give an example of what you have and what you need to get? Avoid using "these table", "another table", instead of that, you should name...
April 5, 2013 at 1:15 pm
This should do the trick to avoid ISNUMERIC
WITH CTE AS(
SELECT 'SBA 60 OFF 19.99 NOW 7.99' as String
UNION ALL
SELECT 'SBA 50 OFF 99.99 NOW 49.99'
UNION ALL
SELECT...
April 5, 2013 at 1:09 pm
You could do it via trigger FOR INSERT or as part of the procedure used to insert the row using the OUTPUT clause.
However, if you're just copying all the rows...
April 5, 2013 at 12:39 pm
The queries will be inefficient, unless you correct your data.
Here's one option, but you'll have a problem with "SouthWest"
SELECT *
FROM #TableRegion t1
FULL JOIN #TableRegionOther t2
ON CHARINDEX( SUBSTRING(t1.Region, 2, 4), t2.Region)...
April 3, 2013 at 1:42 pm
Viewing 15 posts - 8,146 through 8,160 (of 8,731 total)