Questions tagged as 'sql-server'

1
answer

Modify data type sql

I am trying to modify a data type from varchar (20) to varchar (50) I have this query ALTER TABLE ALUMNO MODIFY DESCRIPCION VARCHAR(40); but I have an error near MODIFY : Incorrect syntax near 'MODIFY'. Somebody could help me p...
asked by 22.02.2018 / 15:52
2
answers

SQL SERVER. Add the amount of all records

I have an example problem about bank transactions. My table contains a lot of data such as Cash, Office, Name, Last Name, Date, ID, Amount, Type ... Each box (there are several) has several offices, and these in turn have many customers. Afte...
asked by 01.02.2018 / 16:27
1
answer

Use SCOPE_IDENTITY to fetch the ID of an insert

I have a user table where when adding a user I can assign several hotels, which is another insert to a table from many to many. Researching a bit I can use the scope_identity() to be able to do this since it brings me the last reco...
asked by 24.07.2017 / 23:06
1
answer

Minimum and maximum values in a field in SQL server

As I indicated the maximum and minimum value of an int type field in the database. I tried this code, but it does not work for me. Sexo char(1) CHECK (Sexo IN ('F','M')) //Funciona Nota_Practica int NOT NULL CHECK (Nota_Practica > 0 &...
asked by 06.07.2017 / 20:22
2
answers

Insert disordered in temporary table

When I do the select only returns the query as I want. Select Distinct NombreCliente,OELMDT,OEQLVA,CodigoCliente,TLLINO,TLTX60 From #Templino,#Tempcliente Where (CodigoCliente=CONCAT(RTRIM(#Templino.OEQLVA),'0000'))OR(CodigoCliente = CONCAT(RT...
asked by 01.08.2017 / 10:36
3
answers

How to delete the last comma of a concatenation of a sub query in sql? using XML PATH

the following query returns two fields (DATA1 AND DEPARTMENT) THAT ARE VARCHAR SELECT DATO1 ,(SELECT DD.NombreDepartamento + ',' FROM CIALES AS CT INNER JOIN Departamento AS DD ON CT.ID_DEPARTAMENTO = DD.IdDepartamento ORDER BY C...
asked by 04.11.2016 / 23:54
1
answer

Search data in sql and display it on grid

I am trying to search for products from the database and display them in grid . The code executes the search but does not throw any value. In the database I have the following: create proc [dbo].[spbuscararticulo_venta_codigo] @textob...
asked by 07.11.2016 / 06:03
2
answers

Fatal error: Call to a member function prepare () on a non-object in

Good morning, when I try to consult a folio on my form I get an error that says:    Fatal error: Call to a member function prepare () on a non-object in Here my code: <?php $serverName = "10.21.22.16"; //serverName\instanceName $conn...
asked by 27.02.2017 / 16:40
2
answers

Client - Sql Server 2000 Server

my question is presented, in Sql Server 2000 and Vb6, what I want to do is access with my application to the PC-server from the PC-client to access the data of the database. How do I make that connection? Where do I start ?, Thank you very much...
asked by 18.11.2016 / 19:32
3
answers

Assign a Select to a Table in SQL Function

In a function in SQL Server there is some way to create a table and assign it the value of a query, something like CREATE TABLE AuxAlumnos ( Id int, Nombre varchar (10), Apellido varchar(10) ); And to that table assign the...
asked by 07.04.2017 / 16:36