sql-server

Writing stored procedures when using dynamic schema names in sql server

醉酒当歌 提交于 2021-02-19 04:15:34
问题 The application, I have been currently working with has different schema names for its tables, for example Table1 can have multiple existence say A.Table1 and B.Table1. All my stored procedures are stored under dbo. I'm writing the below stored procedures using dynamic SQL. I'm currently using SQL Server 2008 R2 and soon it will be migrated to SQL Server 2012. create procedure dbo.usp_GetDataFromTable1 @schemaname varchar(100), @userid bigint as begin declare @sql nvarchar(4000) set @sql=

Writing stored procedures when using dynamic schema names in sql server

 ̄綄美尐妖づ 提交于 2021-02-19 04:15:30
问题 The application, I have been currently working with has different schema names for its tables, for example Table1 can have multiple existence say A.Table1 and B.Table1. All my stored procedures are stored under dbo. I'm writing the below stored procedures using dynamic SQL. I'm currently using SQL Server 2008 R2 and soon it will be migrated to SQL Server 2012. create procedure dbo.usp_GetDataFromTable1 @schemaname varchar(100), @userid bigint as begin declare @sql nvarchar(4000) set @sql=

Writing stored procedures when using dynamic schema names in sql server

余生颓废 提交于 2021-02-19 04:14:03
问题 The application, I have been currently working with has different schema names for its tables, for example Table1 can have multiple existence say A.Table1 and B.Table1. All my stored procedures are stored under dbo. I'm writing the below stored procedures using dynamic SQL. I'm currently using SQL Server 2008 R2 and soon it will be migrated to SQL Server 2012. create procedure dbo.usp_GetDataFromTable1 @schemaname varchar(100), @userid bigint as begin declare @sql nvarchar(4000) set @sql=

cannot login to sql server with new user created

爷,独闯天下 提交于 2021-02-19 03:56:08
问题 I created a login named logintest (SQL Authentication) then i created a user named usertest with this login the user creation is successful, And i changed the authentication mode to mixed mode and also restarted the services SQLSERVERAGENT and MSSQLSERVER and still this error appear when i try to login with the new user created Cannot connect to SARAH. Login failed for user 'usertest'. (Microsoft SQL Server, Error: 18456) 回答1: The login must have CONNECT right given. The login must be enabled

java.sql.SQLException: An attempt by a client to checkout a Connection has timed out

拈花ヽ惹草 提交于 2021-02-19 03:25:09
问题 I have a java client server which is supposed to establish connection pool on startup but its failing on timeout error. There are so many threads on this same issue but none of the solutions worked for me AM using jdk 7 and below is the mchange maven dependency <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.2.1</version> </dependency> jdbc.properties url=jdbc\:sqlserver\://server\\instance;databaseName\=db driver=com.microsoft.sqlserver.jdbc

How to implement relational equivalent of the DIVIDE operation in SQL Server

♀尐吖头ヾ 提交于 2021-02-19 03:21:08
问题 I was reading relational algebra from one of the textbook. I came across DIVIDE operation. From Wikipedia: The division is a binary operation that is written as R ÷ S. The result consists of the restrictions of tuples in R to the attribute names unique to R, i.e., in the header of R but not in the header of S, for which it holds that all their combinations with tuples in S are present in R. Thus if R is: +----+----+ | A | B | +----+----+ | a1 | b1 | | a2 | b1 | | a3 | b1 | | a4 | b1 | | a1 |

Date From Week Number and Day In Sql Server 2012

痴心易碎 提交于 2021-02-19 02:57:12
问题 I have day number of the week as well as week number of the year .How can i calculate date of that day in sql .For Example.the day number of 22-Feb-2014 is 7th and it is 8th week of the year.Now how can i calculate the date back from this information.Its urgent.Please help.I want query. 回答1: Here is my verison create FUNCTION date_from_week_number_day ( @year int = 2014 ,@weeknumber int = 8 ,@day int = 7 ) RETURNS date AS BEGIN declare @date date ,@first_date_of_year date set @first_date_of

MMC could not created the snap-in SQL Server configuration manager

心不动则不痛 提交于 2021-02-19 02:53:11
问题 When i tried to connect to sql server configuration manager in sql server 2008. It shows error MMC could not create the snap-in. It was working perfectly till last night. What can be the reason, how can i solve it. But in background sql server is working perfect. 回答1: Win button + R , then type mmc and press enter. Choose File->Add/Remove Snap-in . Click Add to Console Root and find the "SQL Server Configuration Manager" You will be able to use it from there or replace existing console by

Connect to MSSQL from Spring boot application using windows authentication

孤街醉人 提交于 2021-02-19 02:22:28
问题 I am currently using the below properties to connect to a remotely Mssql server from Java spring boot application: spring.datasource.url=jdbc:sqlserver://ip\\domain;databaseName=name spring.datasource.username=abc spring.datasource.password=def spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver The application runs from both windows and unix servers. I need now to start using the windows authentication instead of the db credentials. This is already configured and

Connect to MSSQL from Spring boot application using windows authentication

我是研究僧i 提交于 2021-02-19 02:22:28
问题 I am currently using the below properties to connect to a remotely Mssql server from Java spring boot application: spring.datasource.url=jdbc:sqlserver://ip\\domain;databaseName=name spring.datasource.username=abc spring.datasource.password=def spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver The application runs from both windows and unix servers. I need now to start using the windows authentication instead of the db credentials. This is already configured and