Viewing 15 posts - 2,431 through 2,445 (of 2,451 total)
-- Sample code
CREATE TABLE #T(ID INT, Unit INT)
INSERT INTO #t
SELECT 1,33 UNION ALL
SELECT 2,33 UNION ALL
SELECT 3,25 UNION ALL
SELECT 4,55 UNION ALL
SELECT 5,55
-- Query
SELECT MAX(ID) ID, MAX(Unit) Unit
FROM #t
GROUP BY...
July 16, 2012 at 7:29 am
Sean Lange (7/12/2012)
Not sure if what you posted produces what the OP wants but this...
July 12, 2012 at 10:41 am
I think this is what you are looking for.
-- Sample data
DECLARE @salesStore TABLE([CustomerID] VARCHAR(20));
DECLARE @MyTable TABLE(val varchar(20));
INSERT INTO @salesStore VALUES ('xxx'),('yyy'),('zzz');
-- Insert statement
INSERT INTO @MyTable
SELECT * FROM
(
VALUES ('Store'),('CustomerID'),('int'),('10'),('Sales'),('CustomerID'),('PK_Store_CustomerID')
)...
July 12, 2012 at 9:59 am
CELKO (7/11/2012)
SQL is an abstract model of data. We...
July 12, 2012 at 7:45 am
schleep (7/11/2012)
On one SQL server (2 instances), we get the following error on setuser.
Could not obtain information...
July 11, 2012 at 12:41 pm
sqluser_8119 (7/11/2012)
How do you make this:yyyy/mm/dd hh:mm:ss
Look like this:
mm/dd/yyyy hh:mm --hh:mm needs to be in military time
DECLARE @date datetime = '2012/06/20'
SELECT CONVERT(CHAR(10), CONVERT(datetime, @date,103),101)
July 11, 2012 at 12:18 pm
SGT_squeequal (7/11/2012)
what i want to do is...
July 11, 2012 at 9:24 am
SQLSeTTeR (7/11/2012)
Alan - Thank you very much. This did the trick.
No problem.:cool:
July 11, 2012 at 8:36 am
Sony Francis @EY (7/11/2012)
select @v-2 =case when t1.col2 like '%*%' then t2.col2 else t1.col2 end
from...
July 11, 2012 at 8:35 am
I think this is what you are looking for:
DECLARE @d1int = 1,
@v-2 varchar(2);
DECLARE @table1 TABLE
(
idint,
col2varchar(2)
);
DECLARE @table2 TABLE
(
idint,
col2varchar(2)
);
INSERT INTO @table1
VALUES (1,'aa'),(2,'bb'),(3,'d*')
INSERT INTO @table2
VALUES (1,'xx'),(2,'yy'),(3,'zz')
SELECT @v-2 =...
July 10, 2012 at 4:54 pm
You mean 128. Yes, that is correct. Thanks!
July 10, 2012 at 3:49 pm
To get the number in MB:
value * 8 / 1024
Example:
Selectname,
size*8/1024
from sys.master_files
July 10, 2012 at 3:03 pm
Everything except for the DB name can be found in sys.database_files. You can get db name with DB_NAME(). The procedure below will get you all this information for every DB...
July 10, 2012 at 2:49 pm
Beginning with SQL Server 2005, they included the INFORMATION_SCHEMA which is a better way to access this kind of information.
For columns you can use INFORMATION_SCHEMA.COLUMNS which, unlike sys.columns, provides the...
July 10, 2012 at 12:56 pm
I also concur with Richard Warr's post. Redgate has a great tool for searching databases and the contents of databases (something worth noting, especially on SQLServerCentral.)
July 10, 2012 at 11:53 am
Viewing 15 posts - 2,431 through 2,445 (of 2,451 total)