Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
samhrishi
Starting Member
13 Posts |
Posted - 2010-11-25 : 02:35:48
|
| Insert query for inserting current year Only into databaseuson vb.net and sqlservertahnkssam |
|
|
Devart
Posting Yak Master
102 Posts |
Posted - 2010-11-25 : 03:05:23
|
| Hello,For exmaple:CREATE table t_year( id_year int);GOINSERT INTO t_year (id_year)SELECT year(getdate());goselect * FROM dbo.t_year;Best regards,Devart,SQL Server Tools:dbForge Schema ComparedbForge Data ComparedbForge Query Builder |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-11-25 : 03:22:16
|
INSERT dbo.TargetTable (Column set here...)SELECT (Column set here...)FROM dbo.SourceTableWHERE SomeDateTimeColumnHere >= DATEADD(YEAR, DATEDIFF(YEAR, 0, GETDATE()), 0)AND SomeDateTimeColumnHere < DATEADD(YEAR, DATEDIFF(YEAR, -1, GETDATE()), 0) N 56°04'39.26"E 12°55'05.63" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-26 : 02:44:08
|
| If the above solution is not what you want, post some sample data with expected resultMadhivananFailing to plan is Planning to fail |
 |
|
|
samhrishi
Starting Member
13 Posts |
Posted - 2010-11-26 : 04:15:43
|
| thaks Devsam |
 |
|
|
|
|
|