Mostrando entradas con la etiqueta SQL SERVER. Mostrar todas las entradas
Mostrando entradas con la etiqueta SQL SERVER. Mostrar todas las entradas

domingo, 31 de julio de 2016

Error 262 al crear una base de datos SQL SERVER

ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
------------------------------
CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262)


Al crear una base de datos con windows 8 y SQL SERVER 2012 parece que es problema de insuficientes permisos, al parecer debí agregarselo al momento de instalacion el rol de sys admin al usuario actual de windows

Are you a member of the sysadmin role? 
When you installed it, there was a page where you specified who should be sys admins for the instance. It doesn't sound like you used the right options (one of them was to Add Current User) (unless this is Express)

Como lo solucione?
Right-click and run "SQL Server Management Studio" as administrator.
In SQL Server Management Studio, connect to an instance of SQL Server.
Click en la carpeta Security para que se expanda luego,  right-click Logins, and then click New Login.
In the Login name box, enter the user name. (en vez de eso, use el boton search y busque mi usuario actual y salio TOSHIBANOTEBOOK\USUARIO ) luego pasamos a la ventana izquierda,
En la ventada izquierda llamada  Select a page, hacemos clic Server Roles, select the sysadmin check box, and then click OK.

http://stackoverflow.com/questions/24198458/how-to-fix-microsoft-sql-server-error-262
http://stackoverflow.com/questions/14625682/create-database-permission-denied-error
https://social.msdn.microsoft.com/Forums/es-ES/b6f73e14-268f-425d-b62e-ee9c2bf023f6/error-262-al-crear-nueva-base-de-datos?forum=sqlserveres

jueves, 9 de junio de 2016

devolver result set o select en mysql con funcion o procedimiento almacenado ademas sql server


2 
In MySQL, a function cannot return a table. You would have to use a stored procedure for that. – Dmytro Shevchenko Nov 6 '12 at 13:11 
4 
What do you mean with "In SQL it's working fine?". You are using SQL.... – a_horse_with_no_name Nov 6 '12 at 13:28
************************
CREATE FUNCTION myFunction(id INT) RETURNS TABLE  
BEGIN  
   RETURN SELECT * FROM board;  
END  
This query gives following error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE  
*********************************
As per documentation on user defined functions in MySQL
you can only return values of type {STRING|INTEGER|REAL|DECIMAL}
CREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}
    SONAME shared_library_name
If you want to read a select resultset you have to define a procedure but not function.
DELIMITER //

DROP PROCEDURE IF EXISTS myProcedure //

CREATE PROCEDURE 
  myProcedure( id INT )
BEGIN  
   SELECT * FROM board
     -- add where condition if required
    WHERE Col_name = id
   ;  
END 
//

DELIMITER ;
And you can call procedure like
call myProcedure( 6 )
That returns implicit objects based on the statements used in the procedure.
************

  
CREATE PROCEDURE myProcedure( id INT ) BEGIN SELECT * FROM board WHERE id = id ; END //check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5– Ankit Aranya May 2 '14 at 6:36 
  
CREATE PROCEDURE myProcedure( id INT ) BEGIN select * from board; END // check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 – Ankit Aranya May 2 '14 at 6:39
  
can you please see this error – Ankit Aranya May 2 '14 at 6:40
  
delimiter was not defined. Answer updated. Please check. – Ravinder Reddy May 2 '14 at 6:48
  
*********
EN SQL SERVER
http://stackoverflow.com/questions/5604927/how-to-return-a-table-from-a-stored-procedure

domingo, 2 de noviembre de 2014

sábado, 30 de agosto de 2014

Como generar el script de las tablas incluyendo sus datos en SQL Server

https://www.youtube.com/watch?v=tS3OCkbKGx0
***************
http://stackoverflow.com/questions/10028805/transfer-data-from-one-database-to-another-database
Resumen
There are several ways to do this, below are two options:
Option 1 - Right click on the database you want to copy
     next (introduction)
  • Choose 'Tasks' > 'Generate scripts'
  • ---
  • 'Select specific database objects' 
  • Check 'Tables'
  • (EN MI CASO ELIGO LA OTRA OPCION SCRIPT ENTIRE DATABASE...)
  • ----
  • Mark 'Save to new query window' (el radio button)
  • Click en el boton 'Advanced'
  • Set 'Types of data to script'  to 'Schema and data'
  • Next, Next
You can now run the generated query on the new database.
Option 2
  • Right click on the database you want to copy
  • 'Tasks' > 'Export Data'
  • Next, Next
  • Choose the database to copy the tables to
  • Mark 'Copy data from one or more tables or views'
  • Choose the tables you want to copy
  • Finish

jueves, 7 de agosto de 2014

SA SQL SERVER 2008

Modificar la contraseña  SA:
https://www.youtube.com/watch?v=_3ZpzOgXqps
Habilitar:
https://www.youtube.com/watch?v=P2P_WR_nrdo

Resumen
************1************
clic derecho en tu conexion -> properties
del panel izquierdo seleccionar security y seleccionar
SQL Server an Windows Authentication mode ok (saldra un mensaje some

of your configuration ok pero no reinicies luego reiniciamos)
************2***
-luego en tu conexion seleccionar la carpeta security -> logins
-selecciona sa (y doble clic)
cambia el password
- y selecciona status del panel izquierdo y habilita el enabled en

lugar del diabled y luego en ok
*************
luego clic derecho en la conexion y Restart