Showing posts with label default. Show all posts
Showing posts with label default. Show all posts

Tuesday, March 27, 2012

Auto date through priority

Hi,

I have a table which contains a Create datetimefield which has a default on the current date , a priorityfield and another datetimefield which will be the due date and has to be calculated by the first date and the priority field,

How can i do this and what fields must i have.

Does someone does this?
can someone help me with this?

Kind regards Wimwhat whould happen to the due-date if the priority changed?|||what whould happen to the due-date if the priority changed?

The due date has to change to!|||use a computed column for the due date, fe:
CREATE TABLE TAB1 (
FIRSTDATE DATETIME DEFAULT GETDATE()
, PRIO INTEGER
, DUEDATE AS DATEADD(DD, PRIO, GETDATE())
)
GO

INSERT INTO TAB1 (PRIO) VALUES (1)
GO

SELECT * FROM TAB1
UPDATE TAB1 SET PRIO = 10
SELECT * FROM TAB1
GO

DROP TABLE TAB1
GO

EDIT: Just to be sure; either have a default prio or have a not null constraint|||use a computed column for the due date, fe:
CREATE TABLE TAB1 (
FIRSTDATE DATETIME DEFAULT GETDATE()
, PRIO INTEGER
, DUEDATE AS DATEADD(DD, PRIO, GETDATE())
)
GO

INSERT INTO TAB1 (PRIO) VALUES (1)
GO

SELECT * FROM TAB1
UPDATE TAB1 SET PRIO = 10
SELECT * FROM TAB1
GO

DROP TABLE TAB1
GO

EDIT: Just to be sure; either have a default prio or have a not null constraint

And what if i use the priority through an foreign key an have several prioritys which uses different time like:

prio 1 = 1day
prio 2 =1 week
prio3 = 1 month

How will it look like then?|||well, it could look like:

CREATE TABLE TAB1 (
FIRSTDATE DATETIME DEFAULT GETDATE()
, PRIO INTEGER NOT NULL
, DUEDATE AS CASE PRIO
WHEN 1 THEN DATEADD(DD, 1, FIRSTDATE)
WHEN 2 THEN DATEADD(WW, 1, FIRSTDATE)
WHEN 3 THEN DATEADD(MM, 1, FIRSTDATE)
ELSE DATEADD(YY, 1, FIRSTDATE)
END
)
GO|||well, it could look like:

CREATE TABLE TAB1 (
FIRSTDATE DATETIME DEFAULT GETDATE()
, PRIO INTEGER NOT NULL
, DUEDATE AS CASE PRIO
WHEN 1 THEN DATEADD(DD, 1, FIRSTDATE)
WHEN 2 THEN DATEADD(WW, 1, FIRSTDATE)
WHEN 3 THEN DATEADD(MM, 1, FIRSTDATE)
ELSE DATEADD(YY, 1, FIRSTDATE)
END
)
GO
Thanx alot man, that hit the spot!!
I really appreciated your help..

Cheers Wim

Auto Commit

Hi All,
I want that by default SQL Server automatically starts a transaction for me
and I must commit every action manualy to really change something in the
database.
I am using SQL Server 2000.
Regards
Chakravarti MukeshHi!
Do please check the SET IMPLICIT_TRANSACTIONS statement in Books OnLine - I
think this is what you need.
Dejan Sarka, SQL Server MVP
Mentor
www.SolidQualityLearning.com
"Chakravarti Mukesh" <cmukesh@.sparshindia.com> wrote in message
news:O6QlPOl%23FHA.1248@.TK2MSFTNGP14.phx.gbl...
> Hi All,
> I want that by default SQL Server automatically starts a transaction for
> me and I must commit every action manualy to really change something in
> the database.
> I am using SQL Server 2000.
> Regards
> Chakravarti Mukesh
>|||Hi,
Thanks. It worked fine. But It needed to be SET every time I open Query
Analyzer.
Chakravarti Mukesh
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:et$9XTl%23FHA.2036@.TK2MSFTNGP14.phx.gbl...
> Hi!
> Do please check the SET IMPLICIT_TRANSACTIONS statement in Books OnLine -
> I think this is what you need.
> --
> Dejan Sarka, SQL Server MVP
> Mentor
> www.SolidQualityLearning.com
> "Chakravarti Mukesh" <cmukesh@.sparshindia.com> wrote in message
> news:O6QlPOl%23FHA.1248@.TK2MSFTNGP14.phx.gbl...
>|||... and if using Query Analyzer, there's a config setting for this.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in m
essage
news:et$9XTl%23FHA.2036@.TK2MSFTNGP14.phx.gbl...
> Hi!
> Do please check the SET IMPLICIT_TRANSACTIONS statement in Books OnLine -
I think this is what you
> need.
> --
> Dejan Sarka, SQL Server MVP
> Mentor
> www.SolidQualityLearning.com
> "Chakravarti Mukesh" <cmukesh@.sparshindia.com> wrote in message
> news:O6QlPOl%23FHA.1248@.TK2MSFTNGP14.phx.gbl...
>|||Chakravarti Mukesh (cmukesh@.sparshindia.com) writes:
> Thanks. It worked fine. But It needed to be SET every time I open Query
> Analyzer.
Tools->Options->Connection Properties.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Go to Tools-->Options-->Connection Properties in Query Analyzer.
I advise caution in using this option. It's unlikely that your applications
will also set this option, so it will be difficult to test procedures and
other batches that are sent by applications that expect
IMPLICIT_TRANSACTIONS to be OFF. You should also be aware that every
statement will start a transaction--even SELECT, so depending on the
TRANSACTION ISOLATION LEVEL, it's possible to block other users' access even
with the most innocent-looking query.
I understand the desire not to screw up the production database with an
ill-formed UPDATE or DELETE statement, but a better solution would be to
first execute the changes against a test database, and once you're satisfied
that the results are correct, to then issue the batch against the production
database.
"Chakravarti Mukesh" <cmukesh@.sparshindia.com> wrote in message
news:%23UVBRhl%23FHA.4012@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Thanks. It worked fine. But It needed to be SET every time I open Query
> Analyzer.
> Chakravarti Mukesh
> "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
> message news:et$9XTl%23FHA.2036@.TK2MSFTNGP14.phx.gbl...
>|||I think Dejan was trying to suggest you use this setting in your procedures.
:)
I personally prefer explicit transactions - they can be started when needed
and rolled back or committed as appropriate based on the requirements of eac
h
individual case. But maybe I'm just a control freak.
ML
http://milambda.blogspot.com/

Monday, February 13, 2012

attaching a link to an email subscription

Our report manager and reports are accessed over a secure conection but the link uses http:// by default. where can i change that to https://?

You can change default report serwer url address in configuration files of your report server (rsreportserver.config or something like that)

Thursday, February 9, 2012

Attach to SQL Server 2K5 Express Problem

I am building a web app using VS 2K5 with SQL Server Express as the backend.
The project and database are stored in the default location: My
Documents\Visual Studio 2005\WebSites\MyWebSiteName. I also downloaded and
installed the SQL Server Management Studio Express to be able to manage the
database. The problem I have is that I am unable to attach the database. I
go through the process but the SSMSE won't allow me to navigate to where my
database is. I'm needing to import a table with a lot of data. Is this a
bug? Do I need to temporarily move my database file? Thanks.
hi Phill,
Phill wrote:
> I am building a web app using VS 2K5 with SQL Server Express as the
> backend. The project and database are stored in the default location:
> My Documents\Visual Studio 2005\WebSites\MyWebSiteName. I also
> downloaded and installed the SQL Server Management Studio Express to
> be able to manage the database. The problem I have is that I am
> unable to attach the database. I go through the process but the
> SSMSE won't allow me to navigate to where my database is. I'm
> needing to import a table with a lot of data. Is this a bug? Do I
> need to temporarily move my database file? Thanks.
I do not currently have VS2005 installed, but with SSMSE I was able to
navigate to My Documents\Visual Studio 2005\WebSites\MyWebSiteName (the
\WebSites\MyWebSiteName folders have been actually created by me as, again,
I do not have VS2005 installed on that machine) both with a windows
administrator member (trusted connections) and the "traditional" "sa" SQL
Server login (mixed mode security)
I do not think VS2005 sets some sort of particular ACLs for that folder,
but I can be wrong here..
the account running my SQLExpress instance is LocalSystem..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||When you created the database in that location, you probably did it as a
user instance because that's the Visual Studio default. The user running
Visual Studio has permissions to that directory because he created it. You
are now trying to attach it to the main SQL Server instance instead of the
user instance, The main SQL Express instance is running as Network Service
and more than likely does not have permissions to open files in you
application directory. You can get around this by giving Network Service
read-write permission on the database and log files. Be aware that while
the files are attached to the main instance, your application using the user
instance connection will not be able to access them.
Check this article for an explanation of user instances:
http://msdn.microsoft.com/sql/expres...xpuserinst.asp
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Phill" <Phill@.discussions.microsoft.com> wrote in message
news:1CF63F8E-902B-4AD7-A2F8-B7DA7233D7AE@.microsoft.com...
>I am building a web app using VS 2K5 with SQL Server Express as the
>backend.
> The project and database are stored in the default location: My
> Documents\Visual Studio 2005\WebSites\MyWebSiteName. I also downloaded
> and
> installed the SQL Server Management Studio Express to be able to manage
> the
> database. The problem I have is that I am unable to attach the database.
> I
> go through the process but the SSMSE won't allow me to navigate to where
> my
> database is. I'm needing to import a table with a lot of data. Is this a
> bug? Do I need to temporarily move my database file? Thanks.
|||Thanks, I am now able to connect to the database. It didn't really do me any
good though. I want to import an Access table into it but there aren't any
tools to do so. No ODBC drivers, nothing. So how are we supposed to import
data into SSE2K? Thanks.
"Roger Wolter[MSFT]" wrote:

> When you created the database in that location, you probably did it as a
> user instance because that's the Visual Studio default. The user running
> Visual Studio has permissions to that directory because he created it. You
> are now trying to attach it to the main SQL Server instance instead of the
> user instance, The main SQL Express instance is running as Network Service
> and more than likely does not have permissions to open files in you
> application directory. You can get around this by giving Network Service
> read-write permission on the database and log files. Be aware that while
> the files are attached to the main instance, your application using the user
> instance connection will not be able to access them.
> Check this article for an explanation of user instances:
> http://msdn.microsoft.com/sql/expres...xpuserinst.asp
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Phill" <Phill@.discussions.microsoft.com> wrote in message
> news:1CF63F8E-902B-4AD7-A2F8-B7DA7233D7AE@.microsoft.com...
>
>
|||Use the upsizing Wizard in access to push the data into SSE
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Phill" <Phill@.discussions.microsoft.com> wrote in message
news:F00DFB95-4D36-47CC-9A46-41A5A3577D60@.microsoft.com...[vbcol=seagreen]
> Thanks, I am now able to connect to the database. It didn't really do me
> any
> good though. I want to import an Access table into it but there aren't
> any
> tools to do so. No ODBC drivers, nothing. So how are we supposed to
> import
> data into SSE2K? Thanks.
> "Roger Wolter[MSFT]" wrote: