Questions tagged [sql-scripts]

SQL Scripts are lists of SQL sentences written in a single file, meant to be executed sequentially. Depending on the particular RDBMS system, SQL scripts can have procedural language characteristics, such as control-of-flow constructs.

437 questions
1
vote
4 answers

How to do the subtract function in sql script

I need to write a sql script which is used to calculate our customer left points after redemption at the beginning of each month.But I am not very sure about the difference between SQL query and SQL script. I wrote the two queries to calculate the…
xiaopassion
  • 73
  • 1
  • 9
1
vote
2 answers

Selecting a Max Value based on another variable in SQL

I am trying to create an accurate count of student enrollment. There is an individual record for every course registration and any change to that particular course registration results in another record with an incremental sequence number. My…
jomacm04
  • 11
  • 5
1
vote
4 answers

Cloning a Table without using SELECT TOP (0) * INTO

I need to create a copy of a database table. I require to set the TEXTIMAGE_ON value which can only be created at Creation time and not with ALTER TABLE afterwards. I am also not allowed to alter any database properties beforehand. So basically…
rudimenter
  • 3,242
  • 4
  • 33
  • 46
1
vote
1 answer

How to generate database script without replication data in sql server 2008 R2

I have two server in two areas "WAN" : "distributed system". I applied a merge replication for these two servers (Microsoft Sql Server 2008 R2). Now I'd like to generate the database script "Schema and Data", without replication data informations…
1
vote
0 answers

Table relationship in phpmyadmin mysql not showing

So I am using phpmyadmin to create mysql db. I have made SQL scripts, run it and it is successful but when I go to db > designer in phpmyadmin, it doesnt have relationship (line) between the tables. However, indexes on the table shows it looks like…
1
vote
1 answer

Schedule task in sql express edition using batch file

Requirements - Schedule task in SQL Express Edition. But SQL server Agent functionality is not available in express edition. Possible Solution- Schedule batch file execution to execute sql script. Tried Batch File-cmd /k sqlcmd -i backup.sql Sql…
Hot Cool Stud
  • 1,145
  • 6
  • 25
  • 50
1
vote
1 answer

SQL update column with correct ID from different table

Okay to start off - I've mucked up! I have two tables that record all auctions - Bought & Sold - and each Sold record has a bidID value that joins it to the Bought record. Each item that has bought has a unique itemID value but there are occasions…
CPB07
  • 679
  • 3
  • 13
  • 23
1
vote
1 answer

getting mathematical operation of tow result in sql

I am using SQL Server I have 2 tables : table1 : for buying data data {item_id,price ,...} table2 for shopingcart data (item_id,datetime,...) How can I find the probability of buying which is equal to = number_of_item_in table2 / number_of_item_in…
Maria
  • 169
  • 1
  • 3
  • 11
1
vote
1 answer

EF5 Database Migrations: How to move data

I'm using EF5 code first and now I need to update my database so I enabled database migrations and added a migration but the generated code was not what I needed. This is the code: public override void Up() { CreateTable( …
jcgalveza
  • 371
  • 5
  • 13
1
vote
1 answer

Including system tables in SQL Server Management Studio generated scripts

I'm currently facing a problem when scripting my development db with SQL Server Management Studio. I'm developing an application using EF5 code first and I'm constantly moving my development db from one machine to the other. The method I'm using to…
jcgalveza
  • 371
  • 5
  • 13
1
vote
0 answers

Auto execute custom scripts after generating database from model in EF

I'm using EF 4.0 and I'm constantly performing Generate database from model in my edmx. After each time, I have to execute a bunch of different scripts other than the auto generated edmx.sql script. I'm wondering if there is a way to add something…
Bizhan
  • 16,157
  • 9
  • 63
  • 101
1
vote
1 answer

Oracle: How to round and update all numbers in a table?

I have a table with several columns, with DATA_TYPE FLOAT, NUMBER. There are whole numbers and decimal digits with decimal places. e.g. 234, 4, 0, 23.000000004, 234,4444, ... Assignment: I want that the numbers have 2 decimal places at maximum. If…
florian.isopp
  • 834
  • 2
  • 12
  • 36
1
vote
1 answer

How to create sql script to dump sql server table data?

I am new to sql scripting. I have a problem where I sometimes run a standalone mode that doesn't allow a connection from my database to my actual program. I am trying to automate a way to take the data out of my sql server database and push it to my…
user10297
  • 139
  • 4
  • 11
1
vote
1 answer

SQL Server - Scripting CREATE USER WITHOUT LOGIN

I have a SQL Server instance using SQL Authentication only. I will have only two users and one database on this instance. The SA has a user name of XX. I have another user and lets say that user is X. And, in my create scripts, I am adding X as…
Mike Malter
  • 1,018
  • 1
  • 14
  • 38
1
vote
0 answers

How to set permission by InstallShield?

I create database in InstallShield 2010 by Sql script and it has this error. Error 27506.Error executing SQL script creatdb.sql. lin7.CREATE DATABASE failed. Some file names listed could not be created. Check related errros. I think my script is…
NASRIN
  • 475
  • 7
  • 22