Suggest Username
Aug 1, 2006
hey can anyone suggest me how to write the efficient( a bit faster) stored proc to generate alternative usernames( with logical variations like the one of hotmail ) if provided one is already present in database... :)
View 5 Replies
ADVERTISEMENT
Jun 2, 2014
I put this together to export the user name /password to a csv file to test my SP to output the user name/password.
DECLARE @user_name varchar(50)
DECLARE @psswrd varchar(10)
SELECT @user_name ,@psswrd
FROM ngweb_bulk_enrollments
EXEC master.dbo.xp_cmdshell 'bcp NGDevl.dbo.ngweb_bulk_enrollments out C: est.csv -Sserver1 -T -t, -r
-c'
This works but I don't get the headers in the file. How can I include the headers?
View 7 Replies
View Related
May 10, 2008
hi
i am using html checkboxes to let user to select categories in which search has to be done. there are 4 checkboxes for 4 categories.
this query i have checked in query anakyzer. this query is working and displaying results.acc to this query user has selected "3 checkboxes" and entered "airports" to search.
SELECT * FROM tbl_Arab_Newsletter WHERE (Month(month) = '2' AND year(month) = '2008') and (cat_number = 1 or cat_number = 2 or cat_number = 3) and (story like '%airports%' )
i have written code like this.
strSQL = "SELECT * FROM tbl_Arab_Newsletter WHERE (Month(month) = '"& m &"' AND year(month) = '"& y &"')"strSQL = strSQL & " and cat_number = 1"
end if
if cat2="on" then 'check box 2 is enabled means this conditionstrSQL = strSQL & " and cat_number = 2"
end if
if cat3="on" then 'check box 3 is enabled means this conditionstrSQL = strSQL & " and cat_number = 3"
end if
if cat4="on" then 'check box 4 is enabled means this conditionstrSQL = strSQL & " and cat_number = 4"
end if
strSQL = strSQL & " and (story like '%" & search & "%')"
but this statements are not working. how to write the if conditon acc to the query. pls help and if dont mind pls give me the correct code.
thank u.
View 3 Replies
View Related
Mar 3, 2003
Please suggest correct answer (A,B,C,D) for the following Question
You are developing an application for a worldwide furniture wholesaler. You need to create an inventory table on each of the databases located in New York, Chicago, Paris, London, San Francisco, and Tokyo. In order to accommodate a distributed environment, you must ensure that each row entered into the inventory table is unique across all location. How can you create the inventory table?
A.Use the identity function. At first location use IDENTITY(1,4), at second location use IDENTITY(2,4), and so on.
B.Use the identity function. At first location use IDENTITY(1,1), at second location use IDENTITY(100000,1), and so on.
C.CREATE TABLE inventory ( Id Uniqueidentifier NOT NULL DEFAULT NEWID(), ItemName Varchar(100) NOT NULL, ItemDescription Varchar(255) NULL, Quantity Int NOT NULL, EntryDate Datetime NOT NULL).
D.Use TIMESTAMP data type.
View 3 Replies
View Related
Apr 9, 2003
Give the suitable answer for the below question and explain the answer.
1.You have designed the database for a Web site (or online ticketing agency) that is used to purchase concert tickets. During a ticket purchase, a buyer view a list of available tickets, decides whether to buy the tickets, and then attempts to purchase the tickets. This list of available tickets is retrieved in a cursor.
For popular concerts, thousands of buyers might attempt to purchase tickets at the same time. Because of the potentially high number of buyers at any one time, you must allow the highest possible level of concurrent access to the data. How should you design the cursor?
(A). Create a cursor within an explicit transaction, and set the transaction isolation level to REPEATABLE READ.
(B). Create a cursor that uses optimistic concurrency and positioned updates. In the cursor, place the positioned UPDATE statements within an explicit transaction.
(C). Create a cursor that uses optimistic concurrency. In the cursor, use UPDATE statements that specify the key value of the row to be updated in the WHERE clause, and place the UPDATE statements within an implicit transaction.
(D). Create a cursor that uses positioned updates. Include the SCROLL_LOCKS argument in the cursor definition to enforce pessimistic concurrency. In the cursor, place the positioned UPDATE statements within an implicit transaction.
View 1 Replies
View Related
Dec 3, 2007
Hi,
I have a table with two columns like this.
teacher table
teacher_id
1
2
3
4
5
6
student table
student_id --teacher_id
1 ----------- 10
1 ----------- 11
2 ----------- 12
2 ----------- 13
2 ----------- 14
3 ----------- 15
4 ----------- 16
Now i need the least assigned teacher_id's in the teachers table. i.e i need teacher_id's 5,6.
One possible way of writing the query is given below.
DECLARE @teachers TABLE
(
teacher_idint
)
INSERT INTO @teachers
SELECT1 UNION ALL
SELECT2 UNION ALL
SELECT3 UNION ALL
SELECT4 UNION ALL
SELECT5 UNION ALL
SELECT6
DECLARE @students TABLE
(
teacher_idint,
student_idint
)
INSERT INTO @students
SELECT1 , 10 UNION ALL
SELECT1 , 11 UNION ALL
SELECT2 , 12 UNION ALL
SELECT2 , 13 UNION ALL
SELECT2 , 14 UNION ALL
SELECT3 , 15 UNION ALL
SELECT4 , 16
-- query starts here
SELECT t.teacher_id
FROM @teachers t LEFT OUTER JOIN @students s
ON t.teacher_id = s.teacher_id
GROUP BY t.teacher_id
HAVING COUNT(s.teacher_id) =
(
SELECT TOP 1 COUNT(s.teacher_id)
FROM @teachers t LEFT OUTER JOIN @students s
ON t.teacher_id = s.teacher_id
GROUP BY t.teacher_id
ORDER BY COUNT(s.teacher_id)
)
-- query ends here
But the problem with this query is, i am using two outer joins on the same query and on the same tables....
If teacher table and student tables have few thousands of records, this query will not perform good....
Please suggest another way of writing the query which can perform well....
Thanks in advance
Suresh
View 5 Replies
View Related
Mar 25, 2008
I am new in sqlserver UDF,
I am written a UDF but it showing error
CREATE FUNCTION udf_DayOfWeek(@dtDate DATETIME)
RETURNS VARCHAR(10)
AS
BEGIN
DECLARE @rtDayofWeek VARCHAR(10)
SELECT @rtDayofWeek = CASE DATEPART(weekday,@dtDate)
WHEN 1 THEN ‘Sunday’
WHEN 2 THEN ‘Monday’
WHEN 3 THEN ‘Tuesday’
WHEN 4 THEN ‘Wednesday’
WHEN 5 THEN ‘Thursday’
WHEN 6 THEN ‘Friday’
WHEN 7 THEN ‘Saturday’
END
RETURN (@rtDayofWeek)
END
GO
Error
Incorrect syntax near '‘'.
Msg 102, Level 15, State 1, Procedure udf_DayOfWeek, Line 16
Incorrect syntax near 'END'.
View 3 Replies
View Related
Mar 21, 2007
Error: 0xC02020A1 at Data Flow Task, Source - mysourcefile [1]: Data conversion failed. The data conversion for column "myBadColumn" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
Error: 0xC020902A at Data Flow Task, Source - mysourcefile [1]: The "output column "myBadColumn" (157)" failed because truncation occurred, and the truncation row disposition on "output column "myBadColumn" (157)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
Two questions:
1. How to tell SSIS not to stop for one bad row. Getting the good rows is more important than one bad row.
2. What code page do I need so this will load?
View 4 Replies
View Related
Mar 21, 2008
hello all Plz can u suggest m how can i find substring like i want to show first 50 characters and i dont want that my last 50th character should end with full word .. word should be complete it may b 53 or 54 th character for example :m using : substring(Remark,0,50) as Remarkand it returns : this is .................................. boobut i want thi is ....................................book.complete sentense plz suggest me how is this be don in SQL query.thax alot
View 3 Replies
View Related
Oct 6, 2005
Hello,First of all - sorry for may be stupid question, but as I am not aWin* administrator and my field is *nix, I am a little bit stuck witha problem, presented to me by one of the customers. He has few windowsboxes with some webfile and (most important) - mssql database. And heasks for a backup. I found some company, which offers us IBM's Tivolisoftware, but my opinion is that they want a little bit too much forit and also, from my *nix experiece, I know there should be manyother products, probably cheaper and better. If not - we will usethat Tivoli. So we need to backup mssql data and some filessomewhere. The best would be on some ftp.Can anyone please suggest a good and simple way of making such kind ofbackup?Many thanks,Anton.
View 2 Replies
View Related
Sep 27, 2007
Hi,
I need you to suggest me one book so that I can learn T-sql - beginner to advanced.
I want to start writing queries like Manivannan and others so that i can also help others
Please suggest and give me a plan. I am ready to sincerely dedicate 2-3 hours every day.
thanks
View 5 Replies
View Related
Nov 17, 2006
Hi,
Can someone suggest me a simple and nice tutorial that can explain T-SQL with examples.
Plizzz....
Regards..,
Aazad
View 2 Replies
View Related
May 22, 2008
Hi all,
What are the factors to be considered while desiging a cube..
creating cube through wizard is the way to do it ?
How to determine abt fact and dimension tables..
pls provide me more links to get more idea about Cubes .. which helps me a lot to furthur proceed.
Thanks,
Nav
View 3 Replies
View Related
Jul 23, 2005
First posting to the group. I have received a lot of valuable info from youguys. Now, an OT question:What's a good tape drive to perform unmanned weekly backups for a WindowsXP Pro box running SQL server 2000?--Joel Farris | AIM: FarrisJoel** Their Web. Your Way. http://getfirefox.com **
View 1 Replies
View Related
Jan 26, 2007
I am trying to recreate the same functionality Google has in regards tosuggesting words (not names), when you misspell something it comes upwith suggestions.We have a list of words in the database to match against.I've looked at SOUNDEX but it is not close enough, DIFFERENCE is evenworse.The only way I can get SOUNDEX to be more accurate is withSELECT [word]FROM [tbl_word]WHERE ( SOUNDEX( word ) = SOUNDEX( 'test' ) AND LEN( word) = LEN('test' ) )I've been looking at Regular Expression matching which I reckon wouldprovide more accurate matches. Not sure how that will affectperformance, as we could be talking about 20,000 records.Or also been looking at the Double Metaphone algorithm.Is there something else that I am missing, anyone know what to use in asituation like this?Thanks in advance.
View 1 Replies
View Related
Oct 24, 2006
Hi,
our company is looking for a good training for SQL server 2005. Majority of attendies will be .NET developers, but some will be technicians who need backup, replication, maint., etc. training. All are pretty familiar with sql server and have experience with SQL 2000. So, it should not be for beginners. Intermediate and advance topics.
Whom you can suggest? Do you have experience with them?
Thank you.
Victor
View 8 Replies
View Related
Feb 21, 2002
Hi!! I use nt groups to give access to users. I need to now the name of the user who is connected to a especific database.
I tryed with suser_name() function but it returns null value because ntgroups are used.
if someone now any function that can help me, i will appreciate your help.
Thanks.
View 1 Replies
View Related
Jan 26, 2008
I just installed SQL 2005 Server. I am using SQL Server 2005.
Why do I have to login with the username with "sa"?
I failed to sign in with other usernames.
What is the trick?
Thanks
View 3 Replies
View Related
Jul 8, 2007
A beginner's question I'm sure. When visitors have logged into my site, how do I then use their UserName as a parameter in an SQL WHERE clause so that I can pull up their detailed information. I'm using VB if additional code is required.
Thanks in advance.
View 2 Replies
View Related
Oct 4, 2005
I built an eommerce site on my local computer at work. It's now time to
put the site on our server and get things rolling... anyways, I'm
trying to perform an sqldump so I can gather the appropriate text files
so I can upload the database. Anyways, the sqldump program I am
using requires a username and password to access the sql database.
I am using MSDE and have no clue as to what the username and password may be....
My VisualStudio .Net automatically connects when I work on the site.
Does anyone know what the default username and password may be or what my options are to get this sqldump to work?
Any help would be appreciated.
View 2 Replies
View Related
Jul 10, 2001
Hello out there in SQL land! I'm writing a T-SQL script to create tables and grantlogins to local machine NT accounts. The problem is that I'm sending this script out to about 1700 machines with 1700 different DomainNames!
So hard-coding the domainusername is NOT an option. In other words, non-networked computers. In the T-SQL command:
EXEC sp_grantlogin [DomainUsername]
-OR-
EXEC sp_grantdbaccess [DomainUsername]
note: Domain= @@SERVERNAME
Username = Jib
I want to have a variable of some sort pass the DomainName & concatenated username in order to grant login the SQL Server for the NT user. Any help would be greatly appreciated.
Thanks!
View 1 Replies
View Related
Dec 13, 1998
how do you send SQL Server the proper username and password in ASP Scripts?
So far, I have: Connection.Open "DSN=DSNname;pwd=password"
Where does username play in all this and what is its format.
Appreciate any help....
View 2 Replies
View Related
Aug 9, 2004
Hi everybody,
Here the environment is application in 3 layers.
So the user in his client machine, access the application in an application server that sends the request to my sql server database server.
My problem is: when I run sp_who from Query Analyzer, I see the host name that is pre-defined inside code application. But, actually, I need to know the user who is requesting the transactio so I can know right the person who is slowing my database performance....
Do you know, any function, procedure or anything else that I can use in the application code in order to provide the user or the host name from the client machine?????
I hope some answers...
Thank you all,
View 7 Replies
View Related
Jan 6, 2005
Hello
Currently, I am using a varchar "UserName" as a primary key instead of an Identity or GUID.
System Info:
When user's sign up they provide the "UserName" that is used as a PK.
Creating a message board type web application.
UserNames will never change.
UserNames are used extensively as FK's in other Tables.
We want to scale well.
Does anyone know the implications?
I understand Joins are faster on numerical values than strings but we will not be performing many joins.
In my case is it better to use Identity as a PK or is it better to use a varchar for a "Users" table?
Thanks
jenn
View 1 Replies
View Related
Apr 25, 2008
Hi all,
I want create a trigger that will log all modification to a table.
I need to identify the username that modified the data.
Here is my problem :
- they are connected to a Terminal Server so stationName il always TSName
- They are using an application I cannot modify that always use the same login information using SQL authenticationMode
So I need to be able to get their Windows session Username.
Is there any way I can do that in my trigger ?
Thanks
View 5 Replies
View Related
Apr 22, 2006
Hi, I hope this is the right place to post this. I am pretty much stuck but think I am doing pretty good so far as I am getting more and more into SQL
using SQL Server 2000 here.
I want to be able to get the last username who replied to a topic. The "DateOfLastReply" works great, it gives me the last date of a reply to a topic so pretty much along with this, I want to get who it was that replied last. Any ideas? so far, I have this but it isnt correct:
SELECT Threads.[ID] 'ThreadID', ThreadName, DateOfCreation 'DateCreated',
(SELECT TOP 1 DateOfReply FROM Replies WHERE Replies.ThreadID = Threads.[ID] ORDER BY DateOfReply DESC) 'LastReplyDate',
(SELECT TOP 1 e.Username FROM Replies, Threads WHERE Replies.UserID = e.[ID] AND Threads.[ID] = Replies.ThreadID AND Threads.ThreadStarterUser = e.[ID] ORDER BY DateOfReply DESC) 'LastUserReplied', --HERE
(SELECT COUNT(ReplyID) FROM Replies WHERE ThreadID = Threads.[ID]) 'NumberOfReplies',
e.username 'UsernameCreator'
FROM Threads
INNER JOIN Users e ON
e.[ID] = ThreadStarterUser
View 6 Replies
View Related
Jul 11, 2007
VB ASP.NET 2.0
How do I get the Authenticated UserName passed to a Select Command of a data control ?
I'm not clear on how to get the logged in username from User.Identity.Name as a string or how to pass it to the Select Command of a control.
I've had some success with SelectParameters / ControlParameter's in the Master Control context, but otherwise I don't understand how to create a Parameter for use with the SQL.
I want to show the user data from a database, based on who is logged in .
Help, greatly appreciated.
Chris
View 8 Replies
View Related
Aug 16, 2004
how can i change the username of SQL Server 2000 from sa to another username?
thank you for the help and for the time
View 7 Replies
View Related
Jan 1, 2005
Hi,
I have installed MSDE using the following parameter:
commandline> setup SAPWD="MySAPwd"
now all was set up... when i opened the osql utility..i wasnt able to login... it kept asking me the login name ans password...
i entered my windows login name which is 'home' and entered 'kham00s' as the password... it didnt work... then i entered my windows login name again which is 'home' and entered 'OTHERPASSWORD' as the password which is my system password...but did not work either...
then i logged in using :
commandline> osql -E
It successfully logged in... and i was able to create databases and tables...
can someone tell me how to set a username and password for MSDE please... so that i can connect to MSDE using WebMatrix...
i m coming from a PHP/MySQL background so i know SQL and stuff... but dont know how to handle and configure MSSQL...
waiting for the response..
thanks in advance...
Bye.
Kamran.
View 6 Replies
View Related
Jan 11, 1999
I want to establish logging using NT Security. The problem is that user names in NT have underscore(_). When I establish NT Scurity in SQL security manager, SQL Server tries to add blank names as login id and they will not go through. Is it manadatory to remove underscore from username?
Because of structrual hierarchy, I have different groups in NT to be mapped to SQL Server groups and each group has different permission on SQL tables. In some cases we might have same users in more than one group. I read that it is not possible if you use NT integrated security. Is there any thing that can be worked around this and is this problem still exists in SQL 7.
Janne Hakulinen gave me a reply (Appreciate that) but when I did as he said, I got no success. So I am asking him to reply me at alim@goldline.net and let me send him an e-mail.
Thank you in advance
Ali Malekshahi
View 1 Replies
View Related
Aug 16, 2000
I need to get into a database and need the password and username for a Microsoft SQL Server v.6.5 database. Can you help or do you know someone else who can? This database is owned by us and this is a "legal" project.
Thank you.
Michael A. Wise
Manager, MIS/IT
EBARA International Corporation
Cryodynamics, Electric Motor, Standard Pumps Divisions
"World's Leader in Liquefied Gas Pumps and Turbines"
350 Salomon Circle
Sparks, Nevada, USA 89434
775-356-2796, xt. 215; FAX: 775-356-2884
mailto:mwise@ebaraintl.com
www.ebara.co.jp/indexe.html
www.ebaratech.com
www.pumpsebara.com
View 1 Replies
View Related
May 23, 2006
Hi I've created a login in my SQL Server 2005 like this:
CREATE LOGIN testuser
WITH PASSWORD = 'TestPWD';
USE DB1;
CREATE USER testuser FOR LOGIN testuser;
GO
now i want to connect from a c# app with the following connection STring
"Data Source=TURM21;Initial Catalog= Db1; Database= Db1 ; USER = testuser; PASSWORD = TestPWD; pooling=false; "
and i get the following Exception:
SqlConnection Handle : System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
CAn somebody help me? Whats wrong? Is it my connection string?
Greetz
View 2 Replies
View Related