Hi basically Im creating a package and I need to back up the table and put the date in the name of the table whenever the package is run, however I get an error when I try and do it, I think it should be possible but im not sure:
SELECT *
INTO tablename + CONVERT(char(10), GETDATE(), 112)
FROM tablename
So the tablename should looksomething like this
tablename20031210
The error message is: incorrect syntax near +
Can anybody help.
ThanksUse dynamic Sql within pl/sql:
l_statement varchar2(100);
begin
l_statement:=' create table name_'||to_char(sysdate,'DDMMRRRR');
l_statement:=l_statement||define colums here
execute immediate l_statement;
end;
eventually you must append an ; at the end of the varchar2 because it is an DDL-Statement
Showing posts with label back. Show all posts
Showing posts with label back. Show all posts
Thursday, March 29, 2012
Adding a sysdate to a table
Hi basically Im creating a package and I need to back up the table and put the date in the name of the table whenever the package is run, however I get an error when I try and do it, I think it should be possible but im not sure:
SELECT *
INTO tablename + CONVERT(char(10), GETDATE(), 112)
FROM tablename
So the tablename should looksomething like this
tablename20031210
The error message is: incorrect syntax near +
Can anybody help.
ThanksMaybe...
Declare @.Query nVarchar(1000)
SET @.Query=N'Select * From ' + 'tablename' + CONVERT(char(10), GETDATE(), 112)
EXECUTE sp_executesql @.Query, N'@.level tinyint', @.level = 35|||Thanks a lot this has been driving me crazy. I had to modify the code slightly but it works fine.
DECLARE @.Query nVarchar(1000)
SET @.Query = N'Select * INTO ' + 'tablename' + CONVERT(char(10), GETDATE(), 112) + 'FROM tablename' EXECUTE sp_executesql @.Query, N'@.level tinyint',
@.level = 35
SELECT *
INTO tablename + CONVERT(char(10), GETDATE(), 112)
FROM tablename
So the tablename should looksomething like this
tablename20031210
The error message is: incorrect syntax near +
Can anybody help.
ThanksMaybe...
Declare @.Query nVarchar(1000)
SET @.Query=N'Select * From ' + 'tablename' + CONVERT(char(10), GETDATE(), 112)
EXECUTE sp_executesql @.Query, N'@.level tinyint', @.level = 35|||Thanks a lot this has been driving me crazy. I had to modify the code slightly but it works fine.
DECLARE @.Query nVarchar(1000)
SET @.Query = N'Select * INTO ' + 'tablename' + CONVERT(char(10), GETDATE(), 112) + 'FROM tablename' EXECUTE sp_executesql @.Query, N'@.level tinyint',
@.level = 35
Thursday, March 22, 2012
adding a break for a /r, is it possible?
I have some data I'm getting back which has address details. The data is separated using a /r. In C# code you can obviously split the /r and replace this with a <br> tag to insert a break. Does anybody know how I can do this within reporting services, is it possible to write some expression to do this? Cheers.
Thanks
Use
=REPLACE(Fields!Address.Value, "/r", vbCrLf")
|||I've tried it and it doesn't work, I've added a quote before the replace vbCrLF but makes no difference|||Sorry, it should be:
=REPLACE(Fields!Address.Value, "/r", vbCrLf)
No quotes as vbCrLf is a built in variable.
sqlMonday, March 19, 2012
add users in a transaction SQL Server 2000
I need to be able to add users to roles in serveral databases and if one of
the inserts fails I need to be able to roll back the whole transaction. I am
getting the following error:
The procedure 'sp_grantlogin' cannot be executed within a transaction.
The procedure 'sp_defaultdb' cannot be executed within a transaction.
The procedure 'sp_grantdbaccess' cannot be executed within a transaction.
The procedure 'sp_addrolemember' cannot be executed within a transaction.You will have to use your own logic to make it RollbackAble:
"sp_grantlogin cannot be executed within a user-defined transaction."
http://msdn2.microsoft.com/en-us/library/ms173449.aspx
Jens K. Suessmeyer.
http://www.sqlserver2005.de
--
"maddog" <maddog@.discussions.microsoft.com> wrote in message
news:2B94A051-19CC-41F1-96B6-AB51D1E5C3B3@.microsoft.com...
>I need to be able to add users to roles in serveral databases and if one of
> the inserts fails I need to be able to roll back the whole transaction. I
> am
> getting the following error:
> The procedure 'sp_grantlogin' cannot be executed within a transaction.
> The procedure 'sp_defaultdb' cannot be executed within a transaction.
> The procedure 'sp_grantdbaccess' cannot be executed within a transaction.
> The procedure 'sp_addrolemember' cannot be executed within a transaction.
the inserts fails I need to be able to roll back the whole transaction. I am
getting the following error:
The procedure 'sp_grantlogin' cannot be executed within a transaction.
The procedure 'sp_defaultdb' cannot be executed within a transaction.
The procedure 'sp_grantdbaccess' cannot be executed within a transaction.
The procedure 'sp_addrolemember' cannot be executed within a transaction.You will have to use your own logic to make it RollbackAble:
"sp_grantlogin cannot be executed within a user-defined transaction."
http://msdn2.microsoft.com/en-us/library/ms173449.aspx
Jens K. Suessmeyer.
http://www.sqlserver2005.de
--
"maddog" <maddog@.discussions.microsoft.com> wrote in message
news:2B94A051-19CC-41F1-96B6-AB51D1E5C3B3@.microsoft.com...
>I need to be able to add users to roles in serveral databases and if one of
> the inserts fails I need to be able to roll back the whole transaction. I
> am
> getting the following error:
> The procedure 'sp_grantlogin' cannot be executed within a transaction.
> The procedure 'sp_defaultdb' cannot be executed within a transaction.
> The procedure 'sp_grantdbaccess' cannot be executed within a transaction.
> The procedure 'sp_addrolemember' cannot be executed within a transaction.
Saturday, February 25, 2012
Add internal drive to one of two nodes within MS 2000 Cluster?
If I offline one of two nodes in a cluster, can I add an internal
drive to the offlined-node, then bring the node back online into the
cluster?
Will this new drive cause any problems?
Thanks.
As the new drive is going to be in different bus(system bus), shouldn't
create any problem. I guess the internal drive to be added is SCSI.
BTW, the ideal sequence will be offline the node, shut down the node, add
the disk and bring the node up online.
Van Thothathri
Windows Clustering
High Availability Microsoft Enterprise Server Products
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Use of included script samples, if any, are subject to the terms specified
at http://www.microsoft.com/info/cpyright.htm
"Eric Cross" <ericwoven@.yahoo.com> wrote in message
news:6a585633.0404021029.6b1b37c2@.posting.google.c om...
> If I offline one of two nodes in a cluster, can I add an internal
> drive to the offlined-node, then bring the node back online into the
> cluster?
> Will this new drive cause any problems?
> Thanks.
drive to the offlined-node, then bring the node back online into the
cluster?
Will this new drive cause any problems?
Thanks.
As the new drive is going to be in different bus(system bus), shouldn't
create any problem. I guess the internal drive to be added is SCSI.
BTW, the ideal sequence will be offline the node, shut down the node, add
the disk and bring the node up online.
Van Thothathri
Windows Clustering
High Availability Microsoft Enterprise Server Products
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Use of included script samples, if any, are subject to the terms specified
at http://www.microsoft.com/info/cpyright.htm
"Eric Cross" <ericwoven@.yahoo.com> wrote in message
news:6a585633.0404021029.6b1b37c2@.posting.google.c om...
> If I offline one of two nodes in a cluster, can I add an internal
> drive to the offlined-node, then bring the node back online into the
> cluster?
> Will this new drive cause any problems?
> Thanks.
Sunday, February 12, 2012
Ad hoc updates to system catalogs are not enabled
Hi,
Some time ago, following a security recommendation, I deleted
sp_change_users_login. Now I want it back. I scripted it as create
from another server. When I try to run it in QA as sa I get "Ad hoc
updates to system catalogs are not enabled The system administrator
must reconfigure SQL Server to allow this.
Server: Msg 259, Level 16, State 1, Procedure sp_change_users_login,
Line 197
Ad hoc updates to system catalogs are not enabled. The system
administrator must reconfigure SQL Server to allow this.
Thanks,
PeterHi Peter,
My name is Michael and I would like to thank you for using Microsoft
newsgroup.
Please try to perform the following SQL statements before you run the
statements for adding the stored procedure.
SP_CONFIGURE 'ALLOW UPDATES', 1
RECONFIGURE WITH OVERRIDE
After adding the stored procedure, please perform the following SQL
statements for safe reason.
SP_CONFIGURE 'ALLOW UPDATES', 0
RECONFIGURE WITH OVERRIDE
allow updates Option
Use the allow updates option to specify whether direct updates can be made
to system tables. By default, allow updates is disabled (set to 0), so
users cannot update system tables through ad hoc updates. Users can update
system tables using system stored procedures only. When allow updates is
disabled, updates are not allowed, even if you have the appropriate
permissions (assigned using the GRANT statement).
When allow updates is enabled (set to 1), any user who has appropriate
permissions can update system tables directly with ad hoc updates and can
create stored procedures that update system tables.
For more information regarding SP_CONFIGURE, please refer to the following
article on SQL Server Books Online.
Topic: "SP_CONFIGURE"
Topic: "allow updates Option"
Thanks for choosing Microsoft.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.|||Hi Peter,
Thank you for choosing Microsoft! Michael is on holiday and I'm his backup.
My name is
Billy and it's my pleasure to further assist you with this issue.
I believe Machael has pointed out the root cause of your issue and his solut
ion is accurate
and workable on your side. For your benefits, here I'd like to follow up wit
h something
important you should pay more attention to, as the system catalogs are very
critical to the
operation of SQL Server.
Please keep in mind that updating fields in system tables can prevent an ins
tance of SQL
Server from running or can cause data loss. If you create stored procedures
while the allow
updates option is enabled, those stored procedures always have the ability t
o update
system tables even after you disable allow updates. On production systems, y
ou should not
enable allow updates except under the direction of Microsoft Product Support
Services.
It is stongly recommend that you enable allow updates only in tightly contro
lled situations.
Prevent other users from accessing SQL Server while you are directly updatin
g system
tables by restarting an instance of SQL Server from the command prompt with
sqlservr -m.
This command starts an instance of SQL Server in single-user mode and enable
s allow
updates.
After successfully updating the system catalogs, please remember changing th
e allow
updates back to 0 AT ONCE, and then restart the instance services.
For more information on how to operate it in minimal configuration mode, ple
ase see the
following topic in Books Onlinie:
"Starting SQL Server with Minimal Configuration"
Thanks for choosing Microsoft.
Billy Yao
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.
Some time ago, following a security recommendation, I deleted
sp_change_users_login. Now I want it back. I scripted it as create
from another server. When I try to run it in QA as sa I get "Ad hoc
updates to system catalogs are not enabled The system administrator
must reconfigure SQL Server to allow this.
Server: Msg 259, Level 16, State 1, Procedure sp_change_users_login,
Line 197
Ad hoc updates to system catalogs are not enabled. The system
administrator must reconfigure SQL Server to allow this.
Thanks,
PeterHi Peter,
My name is Michael and I would like to thank you for using Microsoft
newsgroup.
Please try to perform the following SQL statements before you run the
statements for adding the stored procedure.
SP_CONFIGURE 'ALLOW UPDATES', 1
RECONFIGURE WITH OVERRIDE
After adding the stored procedure, please perform the following SQL
statements for safe reason.
SP_CONFIGURE 'ALLOW UPDATES', 0
RECONFIGURE WITH OVERRIDE
allow updates Option
Use the allow updates option to specify whether direct updates can be made
to system tables. By default, allow updates is disabled (set to 0), so
users cannot update system tables through ad hoc updates. Users can update
system tables using system stored procedures only. When allow updates is
disabled, updates are not allowed, even if you have the appropriate
permissions (assigned using the GRANT statement).
When allow updates is enabled (set to 1), any user who has appropriate
permissions can update system tables directly with ad hoc updates and can
create stored procedures that update system tables.
For more information regarding SP_CONFIGURE, please refer to the following
article on SQL Server Books Online.
Topic: "SP_CONFIGURE"
Topic: "allow updates Option"
Thanks for choosing Microsoft.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.|||Hi Peter,
Thank you for choosing Microsoft! Michael is on holiday and I'm his backup.
My name is
Billy and it's my pleasure to further assist you with this issue.
I believe Machael has pointed out the root cause of your issue and his solut
ion is accurate
and workable on your side. For your benefits, here I'd like to follow up wit
h something
important you should pay more attention to, as the system catalogs are very
critical to the
operation of SQL Server.
Please keep in mind that updating fields in system tables can prevent an ins
tance of SQL
Server from running or can cause data loss. If you create stored procedures
while the allow
updates option is enabled, those stored procedures always have the ability t
o update
system tables even after you disable allow updates. On production systems, y
ou should not
enable allow updates except under the direction of Microsoft Product Support
Services.
It is stongly recommend that you enable allow updates only in tightly contro
lled situations.
Prevent other users from accessing SQL Server while you are directly updatin
g system
tables by restarting an instance of SQL Server from the command prompt with
sqlservr -m.
This command starts an instance of SQL Server in single-user mode and enable
s allow
updates.
After successfully updating the system catalogs, please remember changing th
e allow
updates back to 0 AT ONCE, and then restart the instance services.
For more information on how to operate it in minimal configuration mode, ple
ase see the
following topic in Books Onlinie:
"Starting SQL Server with Minimal Configuration"
Thanks for choosing Microsoft.
Billy Yao
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.
Subscribe to:
Posts (Atom)