Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Friday, March 30, 2012

Problem in inserting binary data in sql;

Hi,

I am facing problem inserting binary data into sql data type varbinary.

I want to save an object data type in var binary data type into sql.It gives a followin error.

The name 'DocumentData' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

I do not use ASP Upload file.

Any type of help .

Thanks in advance

Friend

Hello my friend,

The variable is not being passed to the SQL correctly. For example: -

INSERT INTO tblCountry (CountryName) VALUES ('Italy') - this is fine

INSERT INTO tblCountry (CountryName) VALUES (Italy) - not right because single quotes are missing. However, SQL thinks I am referring to a column name when I say Italy. Check your SQL.

Kind regards

Scotty

|||

Hi,

Thanks for your reply.Follwoing is my code plz review and help me if i am making any mistake.

query =

"Insert into Documents(DocumentID,DocumentName,DocumentData,DocumentType,FileID,Field1,Field2,Field3,Field4)values (@.DocumentID,@.DocumentName,DocumentData,DocumentType,FileID,Field1,Field2,Field3,Field4,)";

sc.Parameters.Add(

"@.DocumentID",SqlDbType.Int, 10);

sc.Parameters.Add(

"@.DocumentName",SqlDbType.VarChar, 15);

sc.Parameters.Add(

"@.DocumentData",SqlDbType.Binary, 15);

sc.Parameters.Add(

"@.DocumentType",SqlDbType.VarChar, 10);

sc.Parameters.Add(

"@.FileID",SqlDbType.Int, 10);

sc.Parameters.Add(

"@.Field1",SqlDbType.VarChar, 15);

sc.Parameters.Add(

"@.Field2",SqlDbType.VarChar, 15);

sc.Parameters.Add(

"@.Field3",SqlDbType.VarChar, 15);

sc.Parameters.Add(

"@.Field4",SqlDbType.VarChar, 15);

sc.Parameters[

"@.DocumentID"].Value = documentid;

sc.Parameters[

"@.DocumentName"].Value = docname;

sc.Parameters[

"@.documentData"].Value=fileimg;

sc.Parameters[

"@.documentType"].Value = doctype;

sc.Parameters[

"@.FileId"].Value = fileid;

sc.Parameters[

"@.Field1"].Value = f1;

sc.Parameters[

"@.Field2"].Value = f2;

sc.Parameters[

"@.Field3"].Value = f3;

sc.Parameters[

"@.Field4"].Value = f4;

sc.CommandText = query;

sc.ExecuteNonQuery();

|||

Hello again my friend,

I see it now. You are missing the @. symbols within the insert statement at the top of your code for every parameter after @.DocumentName. Besides this, have a space between ) and values. Also, you need to take out the comma after Field4 at the end of the values group so it ends in a bracket, not a comma with a bracket. I amend it as follows: -

query ="Insert into Documents (DocumentID,DocumentName,DocumentData,DocumentType,FileID,Field1,Field2,Field3,Field4) values (@.DocumentID,@.DocumentName, @.DocumentData, @.DocumentType, @.FileID, @.Field1, @.Field2, @.Field3, @.Field4)";

Kind regards

Scotty

|||

Hi,

Thanks, thank you very much..

Best Regards,

Adnan

Monday, March 26, 2012

problem in crystal report printing

i have developed a report in crystal report having field object with multiple lines. preview is perfect but it doesn't print in some dot matrix printer. please help me in this regard. thanks in advance.if printer is different then output may vary. use different printer setting for different printers.

Problem in Context connection of CLR Trigger

Hi,
I'm using June CTP Visual Studio 2005.
I have Created CLR Object. In my CLR Method i have opened a
connection like below
public partial class Triggers
{
//In my CLR Method i have Opened the connection like below
[Microsoft.SqlServer.Server.SqlTrigger(Name="ClrTrigger",
Target="Triplets",Event="FOR INSERT")]
public static void CLRTrigger()
{
Triggers objTriggers = new Triggers();
objTriggers.Connection(true);
..
...
Test();
// Here i'm calling one more method Test();
...
...
objTriggers.Connection(false);
}
In this test method i'm Executing the command.
Public void Test()
{
...
SqlCommand cmd = new SqlCommand();
string cmdText = "select dirname from Docs where id=45";
cmd.CommandText = cmdText;
cmd.Connection = con;
try
{
sdr = cmd.ExecuteReader();
}
catch (Exception exp)
{
WriteLog("R E ::: "+exp.Message);
}
.....
}
//Connection open and Close method
public void Connection(bool status)
{
if (status)
{
con = new SqlConnection("context connection = true");
con.Open();
}
else
{
con.Close();
}
}
}
I'm getting the error of Connection already in use. I have properly
opened the connection in begin of
method and Closed in end of method. Inside the execution of method if i
called some method means then it
can also use the same connection. Then Why its giving this error.
Please anybody knows solution to my
problem let me know to solve it.
Thanks,
Vinoth
vinoth@.gsdindia.comHi
Support for SQL Server 2005:
http://communities.microsoft.com/ne...p=sqlserver2005
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"None" wrote:

> Hi,
> I'm using June CTP Visual Studio 2005.
> I have Created CLR Object. In my CLR Method i have opened a
> connection like below
> public partial class Triggers
> {
> //In my CLR Method i have Opened the connection like below
> [Microsoft.SqlServer.Server.SqlTrigger(Name="ClrTrigger",
> Target="Triplets",Event="FOR INSERT")]
> public static void CLRTrigger()
> {
> Triggers objTriggers = new Triggers();
> objTriggers.Connection(true);
> ...
> ....
> Test();
> // Here i'm calling one more method Test();
> ...
> ...
> objTriggers.Connection(false);
> }
> In this test method i'm Executing the command.
> Public void Test()
> {
> ...
> SqlCommand cmd = new SqlCommand();
> string cmdText = "select dirname from Docs where id=45";
> cmd.CommandText = cmdText;
> cmd.Connection = con;
> try
> {
> sdr = cmd.ExecuteReader();
> }
> catch (Exception exp)
> {
> WriteLog("R E ::: "+exp.Message);
> }
> ......
> }
> //Connection open and Close method
> public void Connection(bool status)
> {
> if (status)
> {
> con = new SqlConnection("context connection = true");
> con.Open();
> }
> else
> {
> con.Close();
> }
> }
> }
> I'm getting the error of Connection already in use. I have properly
> opened the connection in begin of
> method and Closed in end of method. Inside the execution of method if i
> called some method means then it
> can also use the same connection. Then Why its giving this error.
> Please anybody knows solution to my
> problem let me know to solve it.
> Thanks,
> Vinoth
> vinoth@.gsdindia.com
>sql

Problem in Context connection of CLR Trigger

Hi,
I'm using June CTP Visual Studio 2005.
I have Created CLR Object. In my CLR Method i have
opened a
connection like below
public partial class Triggers
{
//In my CLR Method i have Opened the connection like below
[Microsoft.SqlServer.Server.Sq­lTrigger(Name="ClrTrigger",
Target="Triplets",Event="FOR INSERT")]
public static void CLRTrigger()
{
Triggers objTriggers = new Triggers();
objTriggers.Connection(true);
...
.....
Test();
// Here i'm calling one more method Test();
....
....
objTriggers.Connection(false);
}
In this test method i'm Executing the command.
Public void Test()
{
....
SqlCommand cmd = new SqlCommand();
string cmdText = "select dirname from Docs where id=45";
cmd.CommandText = cmdText;
cmd.Connection = con;
try
{
sdr = cmd.ExecuteReader();
}
catch (Exception exp)
{
WriteLog("R E ::: "+exp.Message);
}
.......

}
//Connection open and Close method
public void Connection(bool status)
{
if (status)
{
con = new SqlConnection("context connection = true");
con.Open();
}
else
{
con.Close();
}
}
}
I'm getting the error of Connection already in use. I have
properly
opened the connection in begin of

method and Closed in end of method. Inside the execution
of method if i
called some method means then it
can also use the same connection. Then Why its giving this
error.
Please anybody knows solution to my
problem let me know to solve it.
Thanks,
Vinoth
vinoth@.gsdindia.comThere are a couple of possibilities:

1) You can only have one open context connection at a time within a clr procedure ("context connection=true"). Is it possible that in the missing code snippets for your example (...'s) that you are attempting to open another context connection? For instance, calling Triggers.Connection(true) again anywhere prior to the Triggers.Connection(false) call would result in this exception. The call stack where the "Connection already in use" exception is thrown would be useful to track down this cause.

2) June CTP has a couple of bugs where an exception, especially if due to an attention (i.e. cancel) signal, can cause the connection to not properly clean itself up from one invocation of the procedure to the next. This problem would not be apparent on first invocation of the proc, and would temporarily be cleared by running "DBCC FREEPROCCACHE".

One other question I have is how you get the SqlConnection from the CLRTriggers() method to the Test() method. It would appear that the "con" field must be static, true? If this is the case, you will almost certainly run into problems, since your trigger can fire on multiple threads, yet the SqlConnection object is valid only in the procedure in which it was created.

I'd like to note that the recommended use pattern for SqlConnection (and cmd.ExecuteReader) is to put them in a "using" statement to guarantee cleanup and help see the lifetime scope of the connection. i.e.

using (SqlConnection con = new SqlConnection("context connection = true")) {
con.Open();
...
}

and

using (SqlDataReader rdr = cmd.ExecuteReader()) {
...
}

~Alazel

Wednesday, March 21, 2012

Problem getting DTS object to work on a Web form

Hi;

I would like to run a DTS package from the On click button event on a web form.

I tried using code that works in a windows form.

But ASP.net, VS 2005 doesn't like the code.

Here are the libraries that I used with the windows form.

Imports System,Imports System.Data.Imports System.Data.SqlClient.

Is there a library that I am missing ?

And here are the lines of code that won't compile:

Dim oPackageAsNew DTS.Package2Class

Dim oStepAs DTS.Step

Package.LoadFromSQLServer("123WXYZ\TRSQL", , , DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, , , ,"cpyPrinters2Excel", )

I am able to run the above in a windows form with no problem.

Thanks for any insights,

Gordon

Hi GMann,

The Imports statement only imports namespaces. It is not add reference to a certain library.

Since you're running DTS packages, you will need to reference the Microsoft DTSPackage Object (COM) Library(DTS.DLL). Use add reference from the Project menu.

HTH. If this does not answer you question, please feel free to mark it as Not Answered and post your reply. Thanks!

|||

These KB articles will be helpful

http://support.microsoft.com/kb/321525/en-us

http://support.microsoft.com/kb/242391/en-us

Tuesday, March 20, 2012

problem exporting views

While exporting a database with "export > objects > selecting the views"
I get the error:
Invalid object name 'dbo.myview'
The weird thing is that this view allready exists in the destination dbase.
Any help appreciated.
THX"nicholas" <murmurait1@.hotmail.com> wrote in
news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:

> While exporting a database with "export > objects > selecting the
> views" I get the error:
> Invalid object name 'dbo.myview'
> The weird thing is that this view allready exists in the destination
> dbase.
> Any help appreciated.
> THX
>
>
Run the following query in your user database. What are the results?
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = 'myview' and t1.uid = t2.uid
Regards
JTC ^..^|||Sorry to ask, but how can I do this?
I tried the SQL query analyser and inserted:
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid =
t2.uid
but get this message:
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'mydatabase.dbo' does not match with a table name or alias
name used in the query
thx a lot
"JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
> "nicholas" <murmurait1@.hotmail.com> wrote in
> news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
>
> Run the following query in your user database. What are the results?
> select t1.name, t2.name
> from sysobjects t1, sysusers t2
> where t1.name = 'myview' and t1.uid = t2.uid
> --
> Regards
> JTC ^..^|||You are supposed to replace "mydatabase" with the name of your database. And
"myview" with the name
of your view.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"nicholas" <murmurait1@.hotmail.com> wrote in message news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.
gbl...
> Sorry to ask, but how can I do this?
> I tried the SQL query analyser and inserted:
> select t1.name, t2.name
> from sysobjects t1, sysusers t2
> where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid
= t2.uid
> but get this message:
> Server: Msg 107, Level 16, State 2, Line 1
> The column prefix 'mydatabase.dbo' does not match with a table name or ali
as
> name used in the query
> thx a lot
> "JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
> news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
>|||Yes, ofcourse, I did that.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
> You are supposed to replace "mydatabase" with the name of your database.
And "myview" with the name
> of your view.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "nicholas" <murmurait1@.hotmail.com> wrote in message
news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
alias[vbcol=seagreen]
>|||"nicholas" <murmurait1@.hotmail.com> wrote in
news:OQwceImgFHA.3256@.TK2MSFTNGP12.phx.gbl:

> Yes, ofcourse, I did that.
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com>
> wrote in message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
> And "myview" with the name
> news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
> alias
>
Like this...
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = 'tbl_customers' and t1.uid = t2.uid
The idea is that the query will returns all tables named tbl_customers
along with the table owners. Please Copy and Paste the results.
Regards
JTC ^..^|||Go back to the proposed query, and fix below things:
Do not remove the quotes around the name of the view in the WHERE clause. Do
not fully qualify the
object name in the where clause.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"nicholas" <murmurait1@.hotmail.com> wrote in message news:OQwceImgFHA.3256@.TK2MSFTNGP12.phx.
gbl...
> Yes, ofcourse, I did that.
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
> And "myview" with the name
> news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
> alias
>

problem exporting views

While exporting a database with "export > objects > selecting the views"
I get the error:
Invalid object name 'dbo.myview'
The weird thing is that this view allready exists in the destination dbase.
Any help appreciated.
THX
"nicholas" <murmurait1@.hotmail.com> wrote in
news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:

> While exporting a database with "export > objects > selecting the
> views" I get the error:
> Invalid object name 'dbo.myview'
> The weird thing is that this view allready exists in the destination
> dbase.
> Any help appreciated.
> THX
>
>
Run the following query in your user database. What are the results?
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = 'myview' and t1.uid = t2.uid
Regards
JTC ^..^
|||Sorry to ask, but how can I do this?
I tried the SQL query analyser and inserted:
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid = t2.uid
but get this message:
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'mydatabase.dbo' does not match with a table name or alias
name used in the query
thx a lot
"JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
> "nicholas" <murmurait1@.hotmail.com> wrote in
> news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
>
> Run the following query in your user database. What are the results?
> select t1.name, t2.name
> from sysobjects t1, sysusers t2
> where t1.name = 'myview' and t1.uid = t2.uid
> --
> Regards
> JTC ^..^
|||You are supposed to replace "mydatabase" with the name of your database. And "myview" with the name
of your view.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"nicholas" <murmurait1@.hotmail.com> wrote in message news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
> Sorry to ask, but how can I do this?
> I tried the SQL query analyser and inserted:
> select t1.name, t2.name
> from sysobjects t1, sysusers t2
> where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid = t2.uid
> but get this message:
> Server: Msg 107, Level 16, State 2, Line 1
> The column prefix 'mydatabase.dbo' does not match with a table name or alias
> name used in the query
> thx a lot
> "JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
> news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
>
|||Yes, ofcourse, I did that.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
> You are supposed to replace "mydatabase" with the name of your database.
And "myview" with the name
> of your view.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "nicholas" <murmurait1@.hotmail.com> wrote in message
news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...[vbcol=seagreen]
alias
>
|||"nicholas" <murmurait1@.hotmail.com> wrote in
news:OQwceImgFHA.3256@.TK2MSFTNGP12.phx.gbl:

> Yes, ofcourse, I did that.
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com>
> wrote in message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
> And "myview" with the name
> news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
> alias
>
Like this...
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = 'tbl_customers' and t1.uid = t2.uid
The idea is that the query will returns all tables named tbl_customers
along with the table owners. Please Copy and Paste the results.
Regards
JTC ^..^
|||Go back to the proposed query, and fix below things:
Do not remove the quotes around the name of the view in the WHERE clause. Do not fully qualify the
object name in the where clause.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"nicholas" <murmurait1@.hotmail.com> wrote in message news:OQwceImgFHA.3256@.TK2MSFTNGP12.phx.gbl...
> Yes, ofcourse, I did that.
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
> And "myview" with the name
> news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
> alias
>

problem exporting views

While exporting a database with "export > objects > selecting the views"
I get the error:
Invalid object name 'dbo.myview'
The weird thing is that this view allready exists in the destination dbase.
Any help appreciated.
THX"nicholas" <murmurait1@.hotmail.com> wrote in
news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
> While exporting a database with "export > objects > selecting the
> views" I get the error:
> Invalid object name 'dbo.myview'
> The weird thing is that this view allready exists in the destination
> dbase.
> Any help appreciated.
> THX
>
>
Run the following query in your user database. What are the results?
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = 'myview' and t1.uid = t2.uid
--
Regards
JTC ^..^|||Sorry to ask, but how can I do this?
I tried the SQL query analyser and inserted:
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid = t2.uid
but get this message:
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'mydatabase.dbo' does not match with a table name or alias
name used in the query
thx a lot
"JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
> "nicholas" <murmurait1@.hotmail.com> wrote in
> news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
> > While exporting a database with "export > objects > selecting the
> > views" I get the error:
> > Invalid object name 'dbo.myview'
> >
> > The weird thing is that this view allready exists in the destination
> > dbase.
> >
> > Any help appreciated.
> >
> > THX
> >
> >
> >
> Run the following query in your user database. What are the results?
> select t1.name, t2.name
> from sysobjects t1, sysusers t2
> where t1.name = 'myview' and t1.uid = t2.uid
> --
> Regards
> JTC ^..^|||You are supposed to replace "mydatabase" with the name of your database. And "myview" with the name
of your view.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"nicholas" <murmurait1@.hotmail.com> wrote in message news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
> Sorry to ask, but how can I do this?
> I tried the SQL query analyser and inserted:
> select t1.name, t2.name
> from sysobjects t1, sysusers t2
> where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid = t2.uid
> but get this message:
> Server: Msg 107, Level 16, State 2, Line 1
> The column prefix 'mydatabase.dbo' does not match with a table name or alias
> name used in the query
> thx a lot
> "JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
> news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
>> "nicholas" <murmurait1@.hotmail.com> wrote in
>> news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
>> > While exporting a database with "export > objects > selecting the
>> > views" I get the error:
>> > Invalid object name 'dbo.myview'
>> >
>> > The weird thing is that this view allready exists in the destination
>> > dbase.
>> >
>> > Any help appreciated.
>> >
>> > THX
>> >
>> >
>> >
>> Run the following query in your user database. What are the results?
>> select t1.name, t2.name
>> from sysobjects t1, sysusers t2
>> where t1.name = 'myview' and t1.uid = t2.uid
>> --
>> Regards
>> JTC ^..^
>|||Yes, ofcourse, I did that.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
> You are supposed to replace "mydatabase" with the name of your database.
And "myview" with the name
> of your view.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "nicholas" <murmurait1@.hotmail.com> wrote in message
news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
> > Sorry to ask, but how can I do this?
> > I tried the SQL query analyser and inserted:
> >
> > select t1.name, t2.name
> > from sysobjects t1, sysusers t2
> > where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid = t2.uid
> >
> > but get this message:
> > Server: Msg 107, Level 16, State 2, Line 1
> > The column prefix 'mydatabase.dbo' does not match with a table name or
alias
> > name used in the query
> >
> > thx a lot
> >
> > "JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
> > news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
> >> "nicholas" <murmurait1@.hotmail.com> wrote in
> >> news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
> >>
> >> > While exporting a database with "export > objects > selecting the
> >> > views" I get the error:
> >> > Invalid object name 'dbo.myview'
> >> >
> >> > The weird thing is that this view allready exists in the destination
> >> > dbase.
> >> >
> >> > Any help appreciated.
> >> >
> >> > THX
> >> >
> >> >
> >> >
> >>
> >> Run the following query in your user database. What are the results?
> >>
> >> select t1.name, t2.name
> >> from sysobjects t1, sysusers t2
> >> where t1.name = 'myview' and t1.uid = t2.uid
> >>
> >> --
> >> Regards
> >> JTC ^..^
> >
> >
>|||"nicholas" <murmurait1@.hotmail.com> wrote in
news:OQwceImgFHA.3256@.TK2MSFTNGP12.phx.gbl:
> Yes, ofcourse, I did that.
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com>
> wrote in message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
>> You are supposed to replace "mydatabase" with the name of your
>> database.
> And "myview" with the name
>> of your view.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "nicholas" <murmurait1@.hotmail.com> wrote in message
> news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
>> > Sorry to ask, but how can I do this?
>> > I tried the SQL query analyser and inserted:
>> >
>> > select t1.name, t2.name
>> > from sysobjects t1, sysusers t2
>> > where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid =>> > t2.uid
>> >
>> > but get this message:
>> > Server: Msg 107, Level 16, State 2, Line 1
>> > The column prefix 'mydatabase.dbo' does not match with a table name
>> > or
> alias
>> > name used in the query
>> >
>> > thx a lot
>> >
>> > "JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
>> > news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
>> >> "nicholas" <murmurait1@.hotmail.com> wrote in
>> >> news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
>> >>
>> >> > While exporting a database with "export > objects > selecting
>> >> > the views" I get the error:
>> >> > Invalid object name 'dbo.myview'
>> >> >
>> >> > The weird thing is that this view allready exists in the
>> >> > destination dbase.
>> >> >
>> >> > Any help appreciated.
>> >> >
>> >> > THX
>> >> >
>> >> >
>> >> >
>> >>
>> >> Run the following query in your user database. What are the
>> >> results?
>> >>
>> >> select t1.name, t2.name
>> >> from sysobjects t1, sysusers t2
>> >> where t1.name = 'myview' and t1.uid = t2.uid
>> >>
>> >> --
>> >> Regards
>> >> JTC ^..^
>> >
>> >
>
Like this...
select t1.name, t2.name
from sysobjects t1, sysusers t2
where t1.name = 'tbl_customers' and t1.uid = t2.uid
The idea is that the query will returns all tables named tbl_customers
along with the table owners. Please Copy and Paste the results.
--
Regards
JTC ^..^|||Go back to the proposed query, and fix below things:
Do not remove the quotes around the name of the view in the WHERE clause. Do not fully qualify the
object name in the where clause.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"nicholas" <murmurait1@.hotmail.com> wrote in message news:OQwceImgFHA.3256@.TK2MSFTNGP12.phx.gbl...
> Yes, ofcourse, I did that.
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:u%23d$xEmgFHA.2472@.TK2MSFTNGP15.phx.gbl...
>> You are supposed to replace "mydatabase" with the name of your database.
> And "myview" with the name
>> of your view.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "nicholas" <murmurait1@.hotmail.com> wrote in message
> news:OcWsU$lgFHA.4000@.TK2MSFTNGP12.phx.gbl...
>> > Sorry to ask, but how can I do this?
>> > I tried the SQL query analyser and inserted:
>> >
>> > select t1.name, t2.name
>> > from sysobjects t1, sysusers t2
>> > where t1.name = [mydatabase].[dbo].[tbl_customers] and t1.uid = t2.uid
>> >
>> > but get this message:
>> > Server: Msg 107, Level 16, State 2, Line 1
>> > The column prefix 'mydatabase.dbo' does not match with a table name or
> alias
>> > name used in the query
>> >
>> > thx a lot
>> >
>> > "JTC ^..^" <dave@.(nospam)JazzTheCat.co.uk> wrote in message
>> > news:Xns968BC0C2DE4E1daveJTC@.213.123.26.234...
>> >> "nicholas" <murmurait1@.hotmail.com> wrote in
>> >> news:Ol2emWkgFHA.1948@.TK2MSFTNGP12.phx.gbl:
>> >>
>> >> > While exporting a database with "export > objects > selecting the
>> >> > views" I get the error:
>> >> > Invalid object name 'dbo.myview'
>> >> >
>> >> > The weird thing is that this view allready exists in the destination
>> >> > dbase.
>> >> >
>> >> > Any help appreciated.
>> >> >
>> >> > THX
>> >> >
>> >> >
>> >> >
>> >>
>> >> Run the following query in your user database. What are the results?
>> >>
>> >> select t1.name, t2.name
>> >> from sysobjects t1, sysusers t2
>> >> where t1.name = 'myview' and t1.uid = t2.uid
>> >>
>> >> --
>> >> Regards
>> >> JTC ^..^
>> >
>> >
>