Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Wednesday, March 28, 2012

how to assign the view to a user?

im using the Northwind database, i use T-SQL commands to create a view that restricts users from seeing the address, city for all employees.
i dont know how to assign the view to a user in the database using Enterprise manager.
pls help me, im really needing a answer.
thanks!

What do you mean by assign a view to a user, do you just want to grant him Select permissions on the view, or do you want the user to be the owner of the view ?

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||i want the user to be the owner of the view
pls, step by step.
thanks.|||

sp_changeobjectOwner 'dbo.MyTable', 'Scott' -- this will grant ownership of the object to a user named 'Scott'

Check out my SQL Server 2005 Video Tutorials: http://www.learnsqlserver.com/

|||But you should be aware that sp_changeobjectowner is for SQL 2000 only. It is still existing for SQL 2k5 but should not be used anymore in SQL2k5. Use the other options mentioned in the BOL (look in the entry sp_changeobjectowner)

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

Monday, March 26, 2012

How to Archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server Logs/current file. Is there a way I can shorten that file so it won't take so long to view the current file?
Thanks in advance. :eek:DBCC ERRORLOG will rotate the logs. I set up a job to rotate mine once per month.|||DBCC ERRORLOG will rotate the logs. I set up a job to rotate mine once per month.

sp_cycle_errorlog will achieve the same effect. You might also consider taking a look at sp_delete_ backuphistory.

Regards,

hmscott

How to archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server
Logs/current file. Is there a way I can shorten that file so it won't take so
long to view the current file?
Thanks in advance.
New SQL Server DBA
Hi
EXEC sp_cycle_errorlog
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> Hi Guru's,
> It takes me a long time to view in EM under Mangement/SQL Server
> Logs/current file. Is there a way I can shorten that file so it won't take
> so
> long to view the current file?
> Thanks in advance.
> --
> New SQL Server DBA
|||THANKS!
New SQL Server DBA
"Mike Epprecht (SQL MVP)" wrote:

> Hi
> EXEC sp_cycle_errorlog
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Newbie" <Newbie@.discussions.microsoft.com> wrote in message
> news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
>
>

How to archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server
Logs/current file. Is there a way I can shorten that file so it won't take so
long to view the current file?
Thanks in advance.
--
New SQL Server DBAHi
EXEC sp_cycle_errorlog
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> Hi Guru's,
> It takes me a long time to view in EM under Mangement/SQL Server
> Logs/current file. Is there a way I can shorten that file so it won't take
> so
> long to view the current file?
> Thanks in advance.
> --
> New SQL Server DBA|||THANKS!
--
New SQL Server DBA
"Mike Epprecht (SQL MVP)" wrote:
> Hi
> EXEC sp_cycle_errorlog
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Newbie" <Newbie@.discussions.microsoft.com> wrote in message
> news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> > Hi Guru's,
> >
> > It takes me a long time to view in EM under Mangement/SQL Server
> > Logs/current file. Is there a way I can shorten that file so it won't take
> > so
> > long to view the current file?
> >
> > Thanks in advance.
> > --
> > New SQL Server DBA
>
>

How to archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server
Logs/current file. Is there a way I can shorten that file so it won't take s
o
long to view the current file?
Thanks in advance.
--
New SQL Server DBAHi
EXEC sp_cycle_errorlog
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> Hi Guru's,
> It takes me a long time to view in EM under Mangement/SQL Server
> Logs/current file. Is there a way I can shorten that file so it won't take
> so
> long to view the current file?
> Thanks in advance.
> --
> New SQL Server DBA|||THANKS!
--
New SQL Server DBA
"Mike Epprecht (SQL MVP)" wrote:

> Hi
> EXEC sp_cycle_errorlog
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Newbie" <Newbie@.discussions.microsoft.com> wrote in message
> news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
>
>

Wednesday, March 21, 2012

How to add txt file in reports design

Hi
I want to add txt file in my report and it should view in Browser.
I need the expression also.
Thanks and Regards
--
asharma1. In visual studio .net 2003, click on tools and select "TEXT"
2. Use your mouse to locate and arrange the size of the area.
3. Enter or copy/paste the txt into this area.
asharma2004 wrote:
>Hi
>I want to add txt file in my report and it should view in Browser.
>I need the expression also.
>Thanks and Regards
--
I am a frog enjoying the sunshine on waikiki beach. Do you want to join with
me?!
Message posted via http://www.sqlmonster.com|||You can also give a link to this txt file using "Action" and when a user
clicks it opens in the browser.
Amarnath, MCTS
"asharma2004" wrote:
> Hi
> I want to add txt file in my report and it should view in Browser.
> I need the expression also.
> Thanks and Regards
> --
> asharma

Monday, March 12, 2012

how to add identity column to a view

hi all,
how to add identity column to a view in sql server 2000.
plz help.
Amit,
Sorry, but you cannot add an identity column to a view. What is your need?
Are you trying to get a row number attached to each row returned? Must it
be in a view or can you use some other mechanism?
You can do the following, but it will get expensive if the result set is
quite large.
SELECT (select count(*) from MyTable where KeyColumn <= a.KeyColumn) AS
RowNumber, a.*
FROM MyTable AS a
ORDER BY RowNumber
RLF
"amit sharma" <amitsharma@.discussions.microsoft.com> wrote in message
news:351A9D82-3E62-465C-90AE-1405C2747667@.microsoft.com...
> hi all,
> how to add identity column to a view in sql server 2000.
> plz help.
>
|||Hi
Along with Russells reply..
You should probably add the "row number" in the client application as this
would be the most efficient way to generate a sequence number.
John
"amit sharma" wrote:

> hi all,
> how to add identity column to a view in sql server 2000.
> plz help.
>
|||hi Russell,
thanx for your reply.
i have a table with identity column and values are not continous in that
column.
thats why i want to create a view which has continous values in identity
column.
so that i can implement custom paging in my front end application.
"Russell Fields" wrote:

> Amit,
> Sorry, but you cannot add an identity column to a view. What is your need?
> Are you trying to get a row number attached to each row returned? Must it
> be in a view or can you use some other mechanism?
> You can do the following, but it will get expensive if the result set is
> quite large.
> SELECT (select count(*) from MyTable where KeyColumn <= a.KeyColumn) AS
> RowNumber, a.*
> FROM MyTable AS a
> ORDER BY RowNumber
> RLF
> "amit sharma" <amitsharma@.discussions.microsoft.com> wrote in message
> news:351A9D82-3E62-465C-90AE-1405C2747667@.microsoft.com...
>
>
|||Hi
You may want to read
http://databases.aspfaq.com/database/how-do-i-page-through-a-recordset.html
John
"amit sharma" wrote:
[vbcol=seagreen]
> hi Russell,
> thanx for your reply.
> i have a table with identity column and values are not continous in that
> column.
> thats why i want to create a view which has continous values in identity
> column.
> so that i can implement custom paging in my front end application.
>
> "Russell Fields" wrote:

how to add identity column to a view

hi all,
how to add identity column to a view in sql server 2000.
plz help.Amit,
Sorry, but you cannot add an identity column to a view. What is your need?
Are you trying to get a row number attached to each row returned? Must it
be in a view or can you use some other mechanism?
You can do the following, but it will get expensive if the result set is
quite large.
SELECT (select count(*) from MyTable where KeyColumn <= a.KeyColumn) AS
RowNumber, a.*
FROM MyTable AS a
ORDER BY RowNumber
RLF
"amit sharma" <amitsharma@.discussions.microsoft.com> wrote in message
news:351A9D82-3E62-465C-90AE-1405C2747667@.microsoft.com...
> hi all,
> how to add identity column to a view in sql server 2000.
> plz help.
>|||Hi
Along with Russells reply..
You should probably add the "row number" in the client application as this
would be the most efficient way to generate a sequence number.
John
"amit sharma" wrote:

> hi all,
> how to add identity column to a view in sql server 2000.
> plz help.
>|||hi Russell,
thanx for your reply.
i have a table with identity column and values are not continous in that
column.
thats why i want to create a view which has continous values in identity
column.
so that i can implement custom paging in my front end application.
"Russell Fields" wrote:

> Amit,
> Sorry, but you cannot add an identity column to a view. What is your need
?
> Are you trying to get a row number attached to each row returned? Must it
> be in a view or can you use some other mechanism?
> You can do the following, but it will get expensive if the result set is
> quite large.
> SELECT (select count(*) from MyTable where KeyColumn <= a.KeyColumn) AS
> RowNumber, a.*
> FROM MyTable AS a
> ORDER BY RowNumber
> RLF
> "amit sharma" <amitsharma@.discussions.microsoft.com> wrote in message
> news:351A9D82-3E62-465C-90AE-1405C2747667@.microsoft.com...
>
>|||Hi
You may want to read
http://databases.aspfaq.com/databas...-recordset.html
John
"amit sharma" wrote:
[vbcol=seagreen]
> hi Russell,
> thanx for your reply.
> i have a table with identity column and values are not continous in that
> column.
> thats why i want to create a view which has continous values in identity
> column.
> so that i can implement custom paging in my front end application.
>
> "Russell Fields" wrote:
>

how to add identity column to a view

hi all,
how to add identity column to a view in sql server 2000.
plz help.Amit,
Sorry, but you cannot add an identity column to a view. What is your need?
Are you trying to get a row number attached to each row returned? Must it
be in a view or can you use some other mechanism?
You can do the following, but it will get expensive if the result set is
quite large.
SELECT (select count(*) from MyTable where KeyColumn <= a.KeyColumn) AS
RowNumber, a.*
FROM MyTable AS a
ORDER BY RowNumber
RLF
"amit sharma" <amitsharma@.discussions.microsoft.com> wrote in message
news:351A9D82-3E62-465C-90AE-1405C2747667@.microsoft.com...
> hi all,
> how to add identity column to a view in sql server 2000.
> plz help.
>|||Hi
Along with Russells reply..
You should probably add the "row number" in the client application as this
would be the most efficient way to generate a sequence number.
John
"amit sharma" wrote:
> hi all,
> how to add identity column to a view in sql server 2000.
> plz help.
>|||hi Russell,
thanx for your reply.
i have a table with identity column and values are not continous in that
column.
thats why i want to create a view which has continous values in identity
column.
so that i can implement custom paging in my front end application.
"Russell Fields" wrote:
> Amit,
> Sorry, but you cannot add an identity column to a view. What is your need?
> Are you trying to get a row number attached to each row returned? Must it
> be in a view or can you use some other mechanism?
> You can do the following, but it will get expensive if the result set is
> quite large.
> SELECT (select count(*) from MyTable where KeyColumn <= a.KeyColumn) AS
> RowNumber, a.*
> FROM MyTable AS a
> ORDER BY RowNumber
> RLF
> "amit sharma" <amitsharma@.discussions.microsoft.com> wrote in message
> news:351A9D82-3E62-465C-90AE-1405C2747667@.microsoft.com...
> > hi all,
> >
> > how to add identity column to a view in sql server 2000.
> > plz help.
> >
>
>|||Hi
You may want to read
http://databases.aspfaq.com/database/how-do-i-page-through-a-recordset.html
John
"amit sharma" wrote:
> hi Russell,
> thanx for your reply.
> i have a table with identity column and values are not continous in that
> column.
> thats why i want to create a view which has continous values in identity
> column.
> so that i can implement custom paging in my front end application.
>
> "Russell Fields" wrote:
> > Amit,
> >
> > Sorry, but you cannot add an identity column to a view. What is your need?
> > Are you trying to get a row number attached to each row returned? Must it
> > be in a view or can you use some other mechanism?
> >
> > You can do the following, but it will get expensive if the result set is
> > quite large.
> >
> > SELECT (select count(*) from MyTable where KeyColumn <= a.KeyColumn) AS
> > RowNumber, a.*
> > FROM MyTable AS a
> > ORDER BY RowNumber
> >
> > RLF
> >
> > "amit sharma" <amitsharma@.discussions.microsoft.com> wrote in message
> > news:351A9D82-3E62-465C-90AE-1405C2747667@.microsoft.com...
> > > hi all,
> > >
> > > how to add identity column to a view in sql server 2000.
> > > plz help.
> > >
> >
> >
> >

Wednesday, March 7, 2012

How to add an image to an SQL Server database

Hi all,

I have a field in the SQL Server database, with 'Image' ad field type.

How can I add a jpeg fiel to it so that I can view it and also access it through a program?

Thanks

Tomy

here

http://www.beansoftware.com/ASP.NET-Tutorials/Images-Database.aspx

How to add an identity PK column to a View

For an ASP.net project, I have had a DropDownList with a static ArrayList.
The ArrayList will be defined from a View, where there is no Identity PK.

I also have used cbxDropDownListName.SelectedIndex to add new data to
a table, where an Indetity PK is used to reference the ArrayList.

I am wondering how can I add an identity PK to my view?

TIA,
Jeffrey

Why don't you select an identity column from one of the tables in the view? Pick an identity column that, by the view definition, would be unique in the view result set.

How to add a variable in Source view ?

There are 3 views in VS IDE, Designer, Code and Source.

In source view, there are html codes, how do I add a variable into it ?

For example:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:JJConnectionString %>"
SelectCommand="SELECT * FROM [Tbl]"

...

How to change the SelectCommand to like:

SelectCommand="SELECT * FROM [Tbl] WHERE [CREATEDBY] = '" & User.Identity.Name & "'"

The User.Identity.Name is not valid in source view, but i need it to work, are there any way ?

Hello my friend,

To use code within aspx/ascx files, you enclose it within <% %> tags. The page directive at the top of your aspx pages is an example of this.

<%@. %> is for directives

<%= %> is for simple printing of code/variables. Try this on your web page: -

<%

=User.Identity.Name %>

<%# %> is for pre-processing but usually used in binding controls to print/use fields of the data source: -

<asp:Repeater ID="rptCountries" runat="server" Visible="true">
<ItemTemplate>
<td width="200"><%# Container.DataItem("CountryName")%><br/>
</ItemTemplate>
</asp:Repeater>

Kind regards

Scotty