Showing posts with label regarding. Show all posts
Showing posts with label regarding. Show all posts

Monday, March 19, 2012

Install database on existing MSDE server with unknown SA password?

Question regarding the MSDE SP3a install process...
What happens if I attempt to install MSDE on a server that already has MSDE
installed and the SA password has been changed to an unknown password? Can
I still install an instance for my database without knowing the SA password?
If not, how can I get around this issue?
I can see my app/database being installed at a customers site that already
has a version of MSDE for a different application they have already
installed and are using.
Thanks,
Jim K.
You should be able to install using Windows authentication, assuming you
know the password for an administrator on the box.
With that, you can also reset the sa password for an existing instance using
sp_password.
http://www.aspfaq.com/
(Reverse address to reply.)
"Jim K" <krusej@.megsinet.net> wrote in message
news:u$W9756gEHA.2952@.TK2MSFTNGP09.phx.gbl...
> Question regarding the MSDE SP3a install process...
> What happens if I attempt to install MSDE on a server that already has
MSDE
> installed and the SA password has been changed to an unknown password?
Can
> I still install an instance for my database without knowing the SA
password?
> If not, how can I get around this issue?
> I can see my app/database being installed at a customers site that already
> has a version of MSDE for a different application they have already
> installed and are using.
> Thanks,
> Jim K.
>

Wednesday, March 7, 2012

Inserting via a view

Hello All, I have an strange issue regarding inserts via a view. Below are
the environemnts and the code. Both environments are identical however,
service packs a different.
Environment 1: This environmnet the insert works
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Windows 2k sp4
Environment 2: This envirnoment the insert fails
Microsoft SQL Server 2000 - 8.00.818 (Intel X86)
Here is the insert statment;
INSERT INTO vMoxyStandardRestriction ( R.RestrictionID,
R.RestrictionType,
R.SecAssocType,
R.RestrictionName,
R.CanOverride,
D.TranCodeBits,
D.MinCompRestPercent,
D.MaxCompRestPercent,
D.IsAggregate,
D.RoundOption,
D.RoundFactor,
D.MinShares,
D.MinValue,
D.CompType)
VALUES (11, 1, 16, 'Unreconciled', 1, 12, 0.000000000000000e+000,
0.000000000000000e+000, 0, 0, 0.000000000000000e+000, 0.000000000000000e+000
,
0.000000000000000e+000, 0)
Here is the code to the view
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
ALTER VIEW vMoxyStandardRestriction AS
SELECT R.RestrictionID, R.RestrictionType, R.SecAssocType,
R.RestrictionName, R.CanOverride,
D.TranCodeBits, D.MinCompRestPercent, D.MaxCompRestPercent, D.IsAggregate,
D.RoundOption, D.RoundFactor, D.MinShares, D.MinValue, D.CompType
FROM MoxyRestriction R, MoxyRestDef D
WHERE R.RestrictionID = D.RestrictionID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GOThis is the error message in the environment which does not work.
Server: Msg 4405, Level 16, State 2, Line 1
View or function 'vMoxyStandardRestriction' is not updatable because the
modification affects multiple base tables.
"FredG" wrote:

> Hello All, I have an strange issue regarding inserts via a view. Below are
> the environemnts and the code. Both environments are identical however,
> service packs a different.
> Environment 1: This environmnet the insert works
> Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
> Windows 2k sp4
> Environment 2: This envirnoment the insert fails
> Microsoft SQL Server 2000 - 8.00.818 (Intel X86)
> Here is the insert statment;
> INSERT INTO vMoxyStandardRestriction ( R.RestrictionID,
> R.RestrictionType,
> R.SecAssocType,
> R.RestrictionName,
> R.CanOverride,
> D.TranCodeBits,
> D.MinCompRestPercent,
> D.MaxCompRestPercent,
> D.IsAggregate,
> D.RoundOption,
> D.RoundFactor,
> D.MinShares,
> D.MinValue,
> D.CompType)
> VALUES (11, 1, 16, 'Unreconciled', 1, 12, 0.000000000000000e+000,
> 0.000000000000000e+000, 0, 0, 0.000000000000000e+000, 0.000000000000000e+0
00,
> 0.000000000000000e+000, 0)
> Here is the code to the view
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS OFF
> GO
> ALTER VIEW vMoxyStandardRestriction AS
> SELECT R.RestrictionID, R.RestrictionType, R.SecAssocType,
> R.RestrictionName, R.CanOverride,
> D.TranCodeBits, D.MinCompRestPercent, D.MaxCompRestPercent, D.IsAggreg
ate,
> D.RoundOption, D.RoundFactor, D.MinShares, D.MinValue, D.CompType
> FROM MoxyRestriction R, MoxyRestDef D
> WHERE R.RestrictionID = D.RestrictionID
> GO
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS ON
> GO|||Hi Fred
Your error messages seems pretty explicit. You cannot insert into a view
that is based on a join. If you could, your single insert would have to put
rows into both the underlying tables, and according to BOL:
[If you insert into a view] .. the modifications made by the INSERT
statement cannot affect more than one of the base tables referenced in the
FROM clause of the view. For example, an INSERT into a multitable view must
use a column_list that references only columns from one base table.
If you are not getting the message for one of your servers, that is the
weirdness. Perhaps you have an INSTEAD OF TRIGGER on the view on that
server.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"FredG" <FredG@.discussions.microsoft.com> wrote in message
news:B1BE7DA5-30D1-41F7-8C63-E213DA147DFA@.microsoft.com...
> Hello All, I have an strange issue regarding inserts via a view. Below are
> the environemnts and the code. Both environments are identical however,
> service packs a different.
> Environment 1: This environmnet the insert works
> Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
> Windows 2k sp4
> Environment 2: This envirnoment the insert fails
> Microsoft SQL Server 2000 - 8.00.818 (Intel X86)
> Here is the insert statment;
> INSERT INTO vMoxyStandardRestriction ( R.RestrictionID,
> R.RestrictionType,
> R.SecAssocType,
> R.RestrictionName,
> R.CanOverride,
> D.TranCodeBits,
> D.MinCompRestPercent,
> D.MaxCompRestPercent,
> D.IsAggregate,
> D.RoundOption,
> D.RoundFactor,
> D.MinShares,
> D.MinValue,
> D.CompType)
> VALUES (11, 1, 16, 'Unreconciled', 1, 12, 0.000000000000000e+000,
> 0.000000000000000e+000, 0, 0, 0.000000000000000e+000,
> 0.000000000000000e+000,
> 0.000000000000000e+000, 0)
> Here is the code to the view
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS OFF
> GO
> ALTER VIEW vMoxyStandardRestriction AS
> SELECT R.RestrictionID, R.RestrictionType, R.SecAssocType,
> R.RestrictionName, R.CanOverride,
> D.TranCodeBits, D.MinCompRestPercent, D.MaxCompRestPercent,
> D.IsAggregate,
> D.RoundOption, D.RoundFactor, D.MinShares, D.MinValue, D.CompType
> FROM MoxyRestriction R, MoxyRestDef D
> WHERE R.RestrictionID = D.RestrictionID
> GO
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS ON
> GO
>

Inserting values into a column by selecting value from different table

Hi, I have a question regarding how to insert one column values into a table by selecting from different table..Here is the syntax..
----
insert into propertytable values (select lastvalue+incrementby from agilesequences where name='SEQPROPERTYTABLE', 13926, 0, 4, 1, 451, 1, 8, 1)

the first column in the propertytable will be... select lastvalue+incrementby from agilesequences where name='SEQPROPERTYTABLE'
How do I do that..Help PLZ..There are probably a number of ways to accomplish this...my preference would be to use a local variable to hold the value.

declare @.seq varchar(20); --[whatever...could be int]

select @.seq = lastvalue+incrementby
from agilesequences
where name='SEQPROPERTYTABLE';

insert into propertytable values (@.seq, 13926, 0, 4, 1, 451, 1, 8, 1);

--------
This should work unless I fat-fingered something.
There may be a way to do this in one pop...
--------|||INSERT INTO propertytable(ColName)
SELECT lastvalue+incrementby
FROM agilesequences
WHERE name='SEQPROPERTYTABLE'

What's this?

13926, 0, 4, 1, 451, 1, 8, 1

And You should supply a collist for the inserted tables...

Damn another fluff reply...|||There are probably a number of ways to accomplish this...my preference would be to use a local variable to hold the value.

declare @.seq varchar(20); --[whatever...could be int]

select @.seq = lastvalue+incrementby
from agilesequences
where name='SEQPROPERTYTABLE';

insert into propertytable values (@.seq, 13926, 0, 4, 1, 451, 1, 8, 1);

--------
This should work unless I fat-fingered something.
There may be a way to do this in one pop...
--------
Thanks a lot guys..
This worked for me.

Friday, February 24, 2012

Inserting Simultaneous tables using Stored Procedure

I am trying to insert into two tables simultaneously from a formview. I read a few posts regarding this, and that is how I've gotten this far. But VWD 2005 won't let me save the following stored procedure. The error I get says"Incorrect syntax near '@.WIP'. Must declare the scalar variable "@.ECReason" and"@.WIP"." I'm probably doing something stupid, but hopefully someone else will be able to save me the days of frustration in finding it. Thanks, the tables and procedures are below.

I made up the two tables just for testing, they are:

tbltest

ECID – int (PK)

ECReason – varchar(50)

tblWIP

WIPID – int (PK)

ECID – int

WIP - varchar(50)

Operation - varchar(50)

CREATE PROCEDUREtestInsert2(

@.ECReasonas varchar(50)
@.WIPas varchar(50)
@.Operationas varchar(50)
)
AS
BEGIN

DECLARE@.ECIDINT
INSERT INTOtbltest(ECReason)VALUES(@.ECReason)

SELECT@.ECID=@.@.IDENTITY

INSERT INTOtblWIP(ECID, WIP, Operation)
VALUES(@.ECID,@.WIP,@.Operation)

END

Thanks again for the help!

I think you forgot the commas between the proc's arguments. Try the following:

CREATE PROCEDURE testInsert2( @.ECReasonas varchar(50), @.WIPas varchar(50), @.Operationas varchar(50) )ASBEGIN DECLARE @.ECIDINT INSERT INTO tbltest(ECReason)VALUES(@.ECReason)SELECT @.ECID=@.@.IDENTITYINSERT INTO tblWIP(ECID, WIP, Operation)VALUES(@.ECID,@.WIP,@.Operation)END

By the way, I don't know about the "as" in the argument declarations. I never use it. I would normally do the following:

CREATE PROCEDURE testInsert2( @.ECReasonvarchar(50), @.WIPvarchar(50), @.Operationvarchar(50) )AS

HTH.

|||

I took the commas out and then it worked. I know I had them in there before, but I must have changed it along the way. I left the rest of it alone and it worked fine. Thanks for the help!

Sunday, February 19, 2012

Inserting problem with sqlserver and vb.net

hi there i ve got a quick question regarding table and adding primary key and values
Basically i have a empty table called ReligionType and have two fields ReligionID and ReligionName. I would like to add a new data into this table (i set the indentity and identity seed in sql server but when i execute the value in sqladapter it give me error on

"An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll"

This is the code that i wrote in vb.net


con2.Open() //sql connection

Me.SqlDataAdapter2.Fill(DataSet1)

Me.SqlInsertCommand2.CommandText() = "Insert into ReligionType(ReligionName) Values (@.ReligionName) SELECT @.@.identity As 'ReligionID' GO"

Me.SqlInsertCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@.RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))

Me.SqlInsertCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@.ReligionName", System.Data.SqlDbType.NVarChar, 20)).Value = inputdata.Text

Me.SqlInsertCommand2.ExecuteNonQuery()

'Me.SqlDataAdapter2.Fill(DataSet1)
con2.Close()

so where did i go wrong ?
please helpHi,
i suppose the SQL should look like this.

"Insert into ReligionType(ReligionName) Values (@.ReligionName); SELECT @.@.identity As 'ReligionID' GO"

Hope this helps.

Regards...|||thanks but it still doesnt work|||The GO command would cause a problem...

The GO command isn't a T-SQL command (although it works in Query Analyzer). Take it out and give it a try.
I haven't looked too hard at the rest of the code...|||Still when i have remove the word go it still doesnt work
ps... i forgot to mention that the data in the table is currently empty

and also have type try and catch statement and this is the result of message

"Object reference not set to an instance of an object."

so what did i do wrong ?