Viewing 15 posts - 6,946 through 6,960 (of 8,731 total)
If it works for you, then is fine. If you want to continue to work with SQL, you should start trying to do it "the right way" because this DB...
February 12, 2014 at 9:21 am
MyDoggieJessie (2/12/2014)
I'd create a little scalar function, should work like a charm:
I wouldn't because it won't, it will just cause performance issues.
I'd create an inLine Table-valued function.
CREATE FUNCTION dbo.ReturnOnlyChars(
@String varchar(8000)--...
February 12, 2014 at 8:51 am
Can you post the code you're using?
You shouldn't have problems, but if you do, you might want to CAST all your int columns into decimal(13,4). You might also have an...
February 12, 2014 at 8:31 am
Here are two options.
DECLARE @Codes TABLE
(
Codes VARCHAR(10)
)
INSERT INTO @Codes
( Codes )
VALUES ('ABC-0350'), ('DEF-00430')
SELECT Codes,
STUFF(Codes, 1, CHARINDEX('-', Codes), ''),
SUBSTRING(Codes, CHARINDEX('-', Codes) + 1, 8000)
FROM @Codes
February 12, 2014 at 8:23 am
For some performance improvement you could pre-aggregate your data. Note that I'm suming the counts but is still a count.
SELECT [date],
SUM( CASE WHEN typesold = 1 THEN amount ELSE 0...
February 11, 2014 at 5:09 pm
sqlvogel (2/11/2014)
In principle any candidate key of a table can be called "primary", meaning it is designated as the "preferred" identifier for information in that table.
That's the point. A table...
February 11, 2014 at 4:25 pm
I'm not sure what you need without DDL, sample data and expected results.
However, those articles have the basic theory to pivot queries both static and dynamic.
For more help, please read...
February 11, 2014 at 4:20 pm
February 11, 2014 at 1:20 pm
Then you'll need to cast as bigint before multiplying.
(CAST( YEAR(getdate()) AS bigint) *10000000)
Why do you need a value like this anyway? What's your serial column data type?
February 11, 2014 at 11:52 am
You have to add the column list to the table you're inserting into.
insert into [AdventureWorks2012].[Sales].[SalesOrderDetail]( <Column list goes here>)
values(43665, 1, 'HkTest', 25, 715, 1, 25.00, 5.00, 25.00, 'B207C96D-D9E6-402B-8470-2CC176C42283', getdate());
February 11, 2014 at 11:42 am
Eugene Elutin (2/11/2014)
February 11, 2014 at 11:37 am
Have you tried Central Management Servers?
February 11, 2014 at 11:31 am
The problem is that '0000000' is being converted to int and adding it to the year. Instead of converting th char and then to int, I would just use some...
February 11, 2014 at 11:26 am
You could as well right-click the database, go to Tasks-> Generate Scripts... and it will help you to script all the objects you need from the db.
February 11, 2014 at 11:08 am
Viewing 15 posts - 6,946 through 6,960 (of 8,731 total)