Viewing 15 posts - 1 through 15 (of 26 total)
HOPE THIS HELP
DECLARE @TABLE_NAME TABLE(
NAME VARCHAR(30),
BDAY CHAR(8))
INSERT INTO @TABLE_NAME(NAME,BDAY)
VALUES('A','20130522')
INSERT INTO @TABLE_NAME(NAME,BDAY)
VALUES('B','20130523')
INSERT INTO @TABLE_NAME(NAME,BDAY)
VALUES('C','20130524')
INSERT INTO @TABLE_NAME(NAME,BDAY)
VALUES('D','20130525')
INSERT INTO @TABLE_NAME(NAME,BDAY)
VALUES('E','20130521')
INSERT INTO @TABLE_NAME(NAME,BDAY)
VALUES('F','20130620')
SELECTNAME,
DATEDIFF(DAY,GETDATE(), CAST(BDAY AS DATETIME)) [BDAY WITHIN 30 DAYS]
FROM@TABLE_NAME
WHEREDATEDIFF(DAY,GETDATE(), CAST(BDAY AS DATETIME))...
May 21, 2013 at 1:05 am
ops sorry for the confusion. I mean the rows in a Table Variables NOT temporary tables.
April 16, 2013 at 12:10 am
have you tried putting name in your derived table?
@link = (SELECT '['+SCHEMA_NAME(schema_id)+'].['+name+']'
AS SchemaTable
FROM sys.tables
where name like '%link%') as "table_name"
January 21, 2013 at 1:53 am
Looping on every row is not a good practice especially on large data. But it will give you an idea where to start 😀
January 21, 2013 at 1:41 am
select Col
from (select * from dbo.TESTTB) as X
unpivot (Col for cols in (col1, col2, col3)) as Y
January 21, 2013 at 1:34 am
if you want to insert the data from the two tables (header and detail) to test table you can do something like this...
1. get the inserted value in dbo.inserted
2. join...
December 30, 2012 at 6:26 am
I still don't understand some of the requirements.
StoreId, Open Date, Closed Date , ReOpen Date, Closed Date 2, ReOpenDate 2 .......
There can be no Reopen & Re-Close for a store...
December 27, 2012 at 8:26 pm
Nice. Now I'm REALLY learning SQL.
Sometimes reading is not enough to learn.
You need to interact or post something so that someone can give comments and give a better...
December 27, 2012 at 7:48 pm
You may want to try this steps.
1. Log on to the machine where the sql server instance resides.
2. Start SSMS. Use windows authentication (assuming your account have access to...
December 27, 2012 at 6:56 pm
Looks like a challenging solutions and I want to try it. I'm not busy today because my boss is on holiday (yehey!!!) :-).Can you post some data and sample output...
December 27, 2012 at 6:25 pm
You can use script task to filter the data.
Pull the data in a flat file, filter the row and insert the data in your sql server database.
December 27, 2012 at 3:13 am
Viewing 15 posts - 1 through 15 (of 26 total)