Showing posts with label documentation. Show all posts
Showing posts with label documentation. Show all posts

Wednesday, March 7, 2012

problems with datepart and weeks

Hi all,

I have a problem with datepart. I want to obtain the week from one date. I have seen the documentation about datepart and the problem with the week counter but I have still problems.

For example.

I want to get the week from this date 29 Dec 2003. This week with DATEFIRST=1 must be the first of 2004 (datepart(ww,'12/29/2003')) but the system give me the 53 week from 2003

the first day of 2004 is on the same week an this function give me different results.

SELECT datepart(ww,'12/29/2003')
SELECT datepart(ww,'1/1/2004')

I don't understand anything ¿?

Thanks a lot.the paper calendar tht you have may show the two dates on same week...but technically the first one is the last week for tht year and the second one is the first week for the year..here the "week" is w.r.t the year..

hth|||I don't understand your reply very well... I read the ISO and it's very clear about what is the first week of the year... but the system works as it wants... if I try this with asp.net it works fine.

Problems with connecting to SQL database on network

Hello.

I have read many posts and documentation on the subject but have not been able to find the answer.So I am posting here in hope that someone could give me good answer.

We are developing an ording system in my company and with weborderingsystem and an backoffice system. We use windows2k3 where sqlserver 2005 is installed and running with our database. Our webapplication is working with this database and is connected to it. This works fine. I am developing backofficepart whick is an C# application and point of this app is that user can check out sent orders, look up orders and customers.

i use C# express to develop this, and use database explorer to try to connect to my the database.

My machine is running WinXp pro and server is win2k3 with SQL Server 2005 on it.

I get this error:

"The file \\810....... is on a network path that is not supported for databasefiles....

the path is this:

\\810-sql2k5\allkopiprivat.test\AllkopiPrivatTest.mdf

Can anyone give me an answer to tell me if this is possible at all or give me an suggestion on how to go about hsi problem. I need my application to connect to another machine on the network that is running SQL server.

PLEASE help.

You should use a connection string to connect to your database from your C# application...not a UNC path. Remember that you are trying to access a database server, not a shared file.|||

Hi.

I changed my connectionstring in my app.config file to access the server but that did not help alot.

do you maybe have a link to some literature or could explain me what to do

|||

This post anwsers your question:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=324783&SiteID=1

Saturday, February 25, 2012

Problems with adding database samples

I have installed the documentation and samples and the management studio for sql 2005 express edition, but when trying to work through the samples, I get this error message, for some reason I can't include the Adventure works db. Whatn I'm I not doing right? Please can someone help!


1> SELECT name from sys.databases
2> Go
name

--

master

tempdb

model

msdb


1> CREATE DATABASE [AdventureWorks] ON
2> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.mdf' ),
3> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.ldf' )
4> FOR ATTACH ;
5> GO
Msg 153, Level 15, State 1, Server YOUR-V7OY5L24PG\SQLEXPRESS, Line 2
Invalid usage of the option AdventureWorks in the CREATE/ALTER DATABASE statemen
t.
1> USE [master]
2> GO
Changed database context to 'master'.
1> CREATE DATABASE [AdventureWorks] ON
2> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.mdf' ),
3> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.ldf' )
4> FOR ATTACH ;
5> GO
Msg 153, Level 15, State 1, Server YOUR-V7OY5L24PG\SQLEXPRESS, Line 2
Invalid usage of the option AdventureWorks in the CREATE/ALTER DATABASE statemen
t.
1> select name from sys.databases
2> go
name

--

master

tempdb

model

msdb


(4 rows affected)
1>

Your create database statement is slightly wrong. If you look at the syntax it is

create database <dbname> ON (Name=<logical name for file>, filename='<filename>')

LOG ON (Name=<logical name for file>, filename='<filename>')

You have combined the logical name for file and filename and ommitted the name and filename keywords.

|||

I am trying to learn SQL 2005 and I am working throught the Microsoft SQL Server 2005 Implementation and Maintenance Training Kit.

I have partitoned out my hard-drive into several partitons.

C,G,H,I,J and K.

Created Sales_Data folders in G,H,I drives

I ran the following code in MSSM Studio:

CREATE DATABASE Sales
ON
PRIMARY
(NAME = 'G:\Sales_Data\SalesPrimary.mdf'
SIZE = 50MB,
MAXSIZE = 200,
FILEGROWTH = 20),
FILEGROUP SalesFG
( NAME = SalesData1,
FILENAME = 'H:\Sales_Data\SalesData1.ndf'
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100),
( NAME = SalesData2,
FILENAME = 'H:\Sales_Data\SalesData2.ndf'
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300),
FILEGROUP SalesHistoryFG
( NAME = SalesHistory1,
FILENAME = 'H:\Sales_Data\SalesHistory1.ndf'
SIZE = 100MB
MAXSIZE = 500,
FILEGROWTH = 50)
LOG ON
(NAME = ArchLog1,
FILENAME = 'I:\Sales_Data\SalesLog.ldf',
SIZE = 300MB,
MAXSIZE = 800,
FILEGROWTH = 100)

I am getting the following error message:

Msg 153, Level 15, State 1, Line 5

Invalid usage of the option SIZE in the CREATE/ALTER DATABASE statement.

Any idea as to why it will not except the syntax for the size option? ny help will be greatly appreciated.

|||Just do a basic check. You miss comma before SIZE option.

CREATE DATABASE Sales
ON
PRIMARY
(NAME = 'G:\Sales_Data\SalesPrimary.mdf', <-Here
SIZE = 50MB,
MAXSIZE = 200,
FILEGROWTH = 20),
FILEGROUP SalesFG
( NAME = SalesData1,
FILENAME = 'H:\Sales_Data\SalesData1.ndf', <-Here
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100),
( NAME = SalesData2,
FILENAME = 'H:\Sales_Data\SalesData2.ndf', <--Here
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300),
FILEGROUP SalesHistoryFG
( NAME = SalesHistory1,
FILENAME = 'H:\Sales_Data\SalesHistory1.ndf', <--Here
SIZE = 100MB, <--And here
MAXSIZE = 500,
FILEGROWTH = 50)
LOG ON
(NAME = ArchLog1,
FILENAME = 'I:\Sales_Data\SalesLog.ldf',
SIZE = 300MB,
MAXSIZE = 800,
FILEGROWTH = 100)


Thanks,
Zuomin

Problems with adding database samples

I have installed the documentation and samples and the management studio for sql 2005 express edition, but when trying to work through the samples, I get this error message, for some reason I can't include the Adventure works db. Whatn I'm I not doing right? Please can someone help!


1> SELECT name from sys.databases
2> Go
name

--

master

tempdb

model

msdb


1> CREATE DATABASE [AdventureWorks] ON
2> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.mdf' ),
3> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.ldf' )
4> FOR ATTACH ;
5> GO
Msg 153, Level 15, State 1, Server YOUR-V7OY5L24PG\SQLEXPRESS, Line 2
Invalid usage of the option AdventureWorks in the CREATE/ALTER DATABASE statemen
t.
1> USE [master]
2> GO
Changed database context to 'master'.
1> CREATE DATABASE [AdventureWorks] ON
2> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.mdf' ),
3> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.ldf' )
4> FOR ATTACH ;
5> GO
Msg 153, Level 15, State 1, Server YOUR-V7OY5L24PG\SQLEXPRESS, Line 2
Invalid usage of the option AdventureWorks in the CREATE/ALTER DATABASE statemen
t.
1> select name from sys.databases
2> go
name

--

master

tempdb

model

msdb


(4 rows affected)
1>

Your create database statement is slightly wrong. If you look at the syntax it is

create database <dbname> ON (Name=<logical name for file>, filename='<filename>')

LOG ON (Name=<logical name for file>, filename='<filename>')

You have combined the logical name for file and filename and ommitted the name and filename keywords.