sql-server-express

GO causes error when used in EXEC: “Incorrect syntax near 'GO'.”

梦想的初衷 提交于 2019-12-02 04:44:43
问题 I've created this stored procedure which dynamically creates the same trigger for all my tables: USE [MyDatabase] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Drop Stored Procedure BEGIN TRY DROP PROCEDURE [dbo].[sp_CreateDataChangedTrigger] END TRY BEGIN CATCH END CATCH GO --Create Stored Procedure -- ================================================ -- Template generated from Template Explorer using: -- Create Procedure (New Menu).SQL -- -- Use the Specify Values for Template

Substring domainname from URL SQL

你说的曾经没有我的故事 提交于 2019-12-02 04:33:49
问题 I have a set of Data: www.google.com.sg www.yahoo.com marketwatch bing.com bbc.co.uk Some data has www. , some doesn't. Some has .com / .com.sg / .com.ul , some doesn't. How do I extract just the name e.g. google , yahoo , marketwatch , bing , bbc using SQL? 回答1: Using MS SQL Server syntax of CHARINDEX and SUBSTRING you could do something like... (Deliberately overly split-up to mak eeach step obvious.) WITH url_start AS ( SELECT *, CASE WHEN LEFT(myURL, 4) = 'www.' THEN 4 ELSE 1 END AS d

SQL Update a table from another table

大城市里の小女人 提交于 2019-12-02 04:28:41
问题 I am a complete beginner to SQL Server, and I have reached my limit. Currently I am using a script to update a table from another table using a column. Since both databases are assigned to 2 different 3rd party software, I created a .bat script to use for task manager in windows server, that way it can update every 10 minutes. While this is tested and works, I feel there has to be a way to create a relationship between the two databases without having to use the task. UPDATE therefore.dbo

SQL proxy/alias for SQL Server Express

余生颓废 提交于 2019-12-02 02:47:58
问题 I can't find what I need or I don't know what to search.Because we are a large team with different setup in our locals, if is possible somehow to enforce connection strings to be persistent across our locals. Example: In config files <connectionStrings> <add name="SomeEntities" connectionString="data source=.\SQLEXPRESS;initial catalog=tests;...rest of it..."/> </connectionStrings> As in my case, because I installed SQL DEVELOPER (version is irrelevant) my local connection will be "data

SQL Update a table from another table

倾然丶 夕夏残阳落幕 提交于 2019-12-02 02:34:12
I am a complete beginner to SQL Server, and I have reached my limit. Currently I am using a script to update a table from another table using a column. Since both databases are assigned to 2 different 3rd party software, I created a .bat script to use for task manager in windows server, that way it can update every 10 minutes. While this is tested and works, I feel there has to be a way to create a relationship between the two databases without having to use the task. UPDATE therefore.dbo.thecat51 SET num_factura = (SELECT therefore.dbo.documentos.num_factura FROM therefore.dbo.Documentos

Using Service Broker with Sql Server Express 2008

≯℡__Kan透↙ 提交于 2019-12-02 01:00:24
问题 Is it possible to use external activation on sql express without going thru sql enterprise/standard? I would like to send a message to sql express service broker, then have it notify my external application service running on the same box, in order to kick off a console app to pickup the message and process it. I do this already successfully from a remote Sql Enterprise db. But now I need everything self contained on one box with Sql express, without using the remote Sql Enterprise. However

GO causes error when used in EXEC: “Incorrect syntax near 'GO'.”

风流意气都作罢 提交于 2019-12-01 23:27:48
I've created this stored procedure which dynamically creates the same trigger for all my tables: USE [MyDatabase] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Drop Stored Procedure BEGIN TRY DROP PROCEDURE [dbo].[sp_CreateDataChangedTrigger] END TRY BEGIN CATCH END CATCH GO --Create Stored Procedure -- ================================================ -- Template generated from Template Explorer using: -- Create Procedure (New Menu).SQL -- -- Use the Specify Values for Template Parameters -- command (Ctrl-Shift-M) to fill in the parameter -- values below. -- -- This block of comments

Restored database missing views, stored procs and foreign keys

情到浓时终转凉″ 提交于 2019-12-01 23:08:46
I'm trying to create a copy of a database in SQL Management Studio (SQL Server Express) using Backup-Restore. Local to local. When I do it it copies tables and data, but ignores views, stored procedures and foreign keys. Object Explorer -> write-click "Databases" -> "Restore Database..." -> put in a name -> select a "from" database -> go This is the script that gets generated: RESTORE DATABASE [DbName_raw] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Backup\DbName.bak.1' WITH FILE = 1, MOVE N'GeoDo' TO N'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS

Android: How can I port ExecuteScalar to Java?

醉酒当歌 提交于 2019-12-01 22:10:12
问题 SqlCommand.ExecuteScalar Method Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored. I guess this will involve heavy use of generics. Assume I have an SQLiteDatabase/Cursor object. 回答1: Have a look at SQLLiteStatement long simpleQueryForLong() Execute a statement that returns a 1 by 1 table with a numeric value. String simpleQueryForString() Execute a statement that returns a 1 by 1 table with a text

Android: How can I port ExecuteScalar to Java?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 20:17:55
SqlCommand.ExecuteScalar Method Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored. I guess this will involve heavy use of generics. Assume I have an SQLiteDatabase / Cursor object. Have a look at SQLLiteStatement long simpleQueryForLong() Execute a statement that returns a 1 by 1 table with a numeric value. String simpleQueryForString() Execute a statement that returns a 1 by 1 table with a text value. This logic worked for me: public int ExecuteScalar(/* code...*/) { Cursor cursor = database